Commit Graph

88 Commits

Author SHA1 Message Date
Martin Brennan 7b31d8a11b
DEV: Move chrome binary check into a shared lib (#13451)
We had checks for the chrome binary in 3 different places
for tests and only one of them checked for google-chrome-stable,
which is problematic for Arch linux users (there are dozens of us!)

This PR moves all the code to one place and references it instead
of copying and pasting.
2021-06-21 13:28:48 +10:00
Josh Soref 59097b207f
DEV: Correct typos and spelling mistakes (#12812)
Over the years we accrued many spelling mistakes in the code base. 

This PR attempts to fix spelling mistakes and typos in all areas of the code that are extremely safe to change 

- comments
- test descriptions
- other low risk areas
2021-05-21 11:43:47 +10:00
David Taylor 414224ce07
DEV: Allow autospec to run full test suite in parallel (#11976)
The definition of 'multiple_files' did not consider that 'spec' refers to the entire `spec/` directory, and therefore includes multiple files
2021-02-04 14:44:40 +00:00
Sam f5945efae7
DEV: watch more test directories (#11346)
Much has moved and autospec stopped picking up certain tests.
2020-11-25 11:12:23 +00:00
David Taylor 24976669b8
DEV: Skip parallel autospec spec for a single file (#11206)
turbo_rspec can't parallelize a single spec file, so it's not worth the extra setup time for the parallel runner
2020-11-11 19:13:32 +00:00
Robin Ward 23f24bfb51 REFACTOR: Move javascript tests inside discourse app
This is where they should be as far as ember is concerned. Note this is
a huge commit and we should be really careful everything continues to
work properly.
2020-10-02 11:29:36 -04:00
Sam Saffron 6d3d9ecf6c
DEV: adjust rake autospec to work with renamed es6 files
We no longer use es6 files, update autospec
2020-03-31 14:40:58 +11:00
Jarek Radosz d21d80198c
DEV: Update rubocop-discourse (#9270)
Includes:
* DEV: Use `eq_time` matcher
2020-03-26 16:32:41 +01:00
Mark VanLandingham 3e89774908
DEV: Use .hbr for raw template file extension (#8883) 2020-02-11 13:38:12 -06:00
David Taylor 9fea43e46a
DEV: Remove use of `cd` in the app (#8337)
`FileUtils.cd` and `Dir.chdir` cause the working directory to change for the entire process. We run sidekiq jobs, hijacked requests and deferred jobs in threads, which can make working directory changes have unintended side-effects.

- Add a rubocop rule to warn about usage of Dir.chdir and FileUtils.cd
- Added rubocop:disable for scripts used outside the app
- Refactored code using cd to use alternative methods
- Temporarily skipped the rubocop check for lib/backup_restore. This will require more complex refactoring, so I will create a separate PR for review
2019-11-13 09:57:39 +00:00
David Taylor cd57c3bf5a
DEV: Abort autospec on [ENTER], even if no specs have failed (#8320)
When starting autospec, it says

> Press [ENTER] to stop the current run

However, [ENTER] does nothing unless a spec has failed. Sometimes I want to abort anyway, so that the run is restarted.
2019-11-08 14:23:12 +00:00
David Taylor da50cd554a
DEV: Optionally allow autospec without auto-running the whole suite (#8321)
I want to use autospec while working on a single spec file. At the moment, it will start running all specs once it completes the file I'm working on. With parallel mode enabled, this causes CPU usage to spike dramatically, affecting IDE performance, battery life, and fan noise. I would prefer that it only runs all specs when I explicitly press [ENTER]

This commit adds a new ENV variable `AUTO_RUN_ALL`. To prevent auto-running all specs, set it to 0. The default behavior remains unchanged.
2019-11-08 14:22:57 +00:00
Sam Saffron fd5c2fbac7 DEV: make parallel spec optional with autospec
At least temporarily while we refine the system keep parallel as optional
2019-06-21 11:00:28 +10:00
Daniel Waterworth e18ce56f4b DEV: Add a new way to run specs in parallel with better output (#7778)
* DEV: Add a new way to run specs in parallel with better output

This commit:

 1. adds a new executable, `bin/interleaved_rspec` which works much like
    `rspec`, but runs the tests in parallel.

 2. adds a rake task, `rake interleaved:spec` which runs the whole test
    suite.

 3. makes autospec use this new wrapper by default. You can disable this
    by running `PARALLEL_SPEC=0 rake autospec`.

It works much like the `parallel_tests` gem (and relies on it), but
makes each subprocess use a machine-readable formatter and parses this
output in order to provide a better overall summary.

(It's called interleaved, because parallel was taken and naming is
hard).

* Make popen3 invocation safer

* Use FileUtils instead of shelling out

* DRY up reporter

* Moved summary logic into Reporter

* s/interleaved/turbo/g

* Move Reporter into its own file

* Moved run into its own class

* Moved Runner into its own file

* Move JsonRowsFormatter under TurboTests

* Join on threads at the end

* Acted on feedback from eviltrout
2019-06-21 10:59:01 +10:00
Joffrey JAFFEUX 2548d5b0e3
DEV: autospec chrome check was failing on macOS (#7649) 2019-05-30 12:09:01 +02:00
Sam Saffron 0ba4ea9718 DEV: bin/rake autospec not working when saving a js file
Frozen string issue
2019-05-30 16:09:45 +10:00
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Sam Saffron 3b77fb1fb1 DEV: support symlinked plugins in bin/rake autospec
Previously autospec would not pick up save if you saved a plugin in a
symlinked path, this broke quite a few workflows

We now maintain a reverse map so we can correctly re-run specs in plugins
2019-05-03 13:51:07 +10:00
David Taylor ef3dd83367 DEV: Remove trailing blank line 2019-04-02 15:49:23 +01:00
David Taylor 02ed5e78e1 DEV: Use parallel-compatible formatter for logging autospec failures
The old method would cause the parallel processes to overwrite each other. The parallel formatter allows multiple processes to write to the same file.
2019-04-02 15:34:30 +01:00
David Taylor 25feb287b8 DEV: Add parallel spec support to autospec
Set PARALLEL_SPEC=1 to use this functionality
2019-04-01 11:06:47 -04:00
Sam Saffron 21c4754324 DEV: check for google-chrome-stable first
on my distro google-chrome-stable is the only binary created when installing
chrome, this ensures we check for it first
2019-03-19 17:33:38 +11:00
David Taylor 9248ad1905 DEV: Enable `Style/SingleLineMethods` and `Style/Semicolon` in Rubocop (#6717) 2018-12-04 11:48:13 +08:00
David Taylor 404acef6e3 DEV: Move `run-qunit.js` out of the vendor directory 2018-12-03 16:16:37 +00:00
Sam 7ba681383d DEV: run plugin tests in autospec 2018-11-23 11:27:08 +11:00
Sam d3b4f24ced DEV: correct watcher for controller specs 2018-08-22 14:35:57 +10:00
Sam cc3fc87dd7 DEV: handle termination cleanly in autospec 2018-06-19 16:13:36 +10:00
Sam db23e10efa DEV: watch plugin.rb in autospec 2018-05-21 15:19:10 +10:00
Matt Palmer 1ce8b7def8 Run a plugin's integration tests via autospec when anything changes 2018-05-09 12:33:12 +10:00
Sam 6a0aeae91b DEV: clean up JavaScript testing
- Unify runner for autospec and qunit:test
- Report on slowest 30 tests
- Use async await instead of promise tower
2018-04-23 14:43:04 +10:00
Guo Xiang Tan 6a4f391e38 Switch to chrome headless mode instead of phantomjs. 2017-12-19 16:00:43 +08:00
Sam 8eb00984ea improve plugin autospec watcher 2017-10-23 10:49:42 +11:00
Sam 70bb2aa426 FEATURE: allow specifying s3 config via globals
This refactors handling of s3 so it can be specified via GlobalSetting

This means that in a multisite environment you can configure s3 uploads
without actual sites knowing credentials in s3

It is a critical setting for situations where assets are mirrored to s3.
2017-10-06 16:20:01 +11:00
Bianca Nenciu 1c079bec33 Remove Spork dependency. 2017-08-10 22:54:52 +01:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam e9fcd348f2 allow watcher to re-trigger specs on markdown change 2017-06-30 12:16:20 -04:00
Sam 234694b50f Feature: CommonMark support
This adds the markdown.it engine to Discourse.
https://github.com/markdown-it/markdown-it

As the migration is going to take a while the new engine is default
disabled. To enable it you must change the hidden site setting:
enable_experimental_markdown_it.

This commit is a squash of many other commits, it also includes some
improvements to autospec (ability to run plugins), and a dev dependency
on the og gem for html normalization.
2017-06-23 12:01:33 -04:00
Sam 435d4d51a4 add support for controller tests 2017-05-30 17:33:01 -04:00
Sam 3aa3c915e7 detect dead qunit 2017-05-24 12:24:34 -04:00
Sam f5f4c36795 Increase autospec qunit timeout to 600 seconds
Correct it so it refocuses on correct runner after running a test
JS tests can not focus on line so skip in vim mode
2017-05-02 16:02:14 -04:00
Sam 556ef4cfbd FIX: case sensitive unconditional add of exact match in user search 2017-05-01 14:37:16 -04:00
Sam a5fc51a967 improve QUNIT support for autospec 2017-05-01 13:50:28 -04:00
Sam Saffron dafc4ec906 qunit runner in autospec has been a mess, opening moves to get it working 2017-04-30 19:45:29 -04:00
Sam Saffron f04fbf911a FEATURE: in vim dev you can focus on spec line in autospec
instructions in bin/notify_file_change
2017-04-25 09:13:29 -07:00
Sam 2bc3aa7ed4 remove no digest refs
the digestless special dev behavior is no longer needed
2017-04-18 17:05:33 -04:00
Sam 2d636406dc FIX: in some case bundle exec fails from spawn
there is some bundler magic in here, prefer bin stubs anyway
cause they are a bit faster
2017-04-13 17:24:58 -04:00
Sam 22214f5e5c Upgrade the Listen gem 2017-04-13 10:39:36 -04:00
Sam a3e8c3cd7b FEATURE: Native theme support
This feature introduces the concept of themes. Themes are an evolution
of site customizations.

Themes introduce two very big conceptual changes:

- A theme may include other "child themes", children can include grand
children and so on.

- A theme may specify a color scheme

The change does away with the idea of "enabled" color schemes.

It also adds a bunch of big niceties like

- You can source a theme from a git repo

- History for themes is much improved

- You can only have a single enabled theme. Themes can be selected by
    users, if you opt for it.

On a technical level this change comes with a whole bunch of goodies

- All CSS is now compiled using a custom pipeline that uses libsass
    see /lib/stylesheet

- There is a single pipeline for css compilation (in the past we used
    one for customizations and another one for the rest of the app

- The stylesheet pipeline is now divorced of sprockets, there is no
   reliance on sprockets for CSS bundling

- CSS is generated with source maps everywhere (including themes) this
    makes debugging much easier

- Our "live reloader" is smarter and avoid a flash of unstyled content
   we run a file watcher in "puma" in dev so you no longer need to run
   rake autospec to watch for CSS changes
2017-04-12 10:53:49 -04:00
Sam 58c2389a7b FEATURE: in dev use #focus to focus on failing test
(comment should be just above the def line)
2016-07-08 12:58:30 +10:00
Sam 29f6d960c6 FIX: autospec not monitoring correctly 2015-12-17 13:17:57 +11:00