test: enable parallel execution of Mocha tests#5831
Merged
raymondfeng merged 3 commits intomasterfrom Jun 30, 2020
Merged
Conversation
Member
Author
|
@raymondfeng Few booter tests are failing in parallel mode, can you PTAL? You can reproduce the problem on $ npm run mocha -- --parallelIt would be great to fix the problem in a new pull request and then rebase this pull request on top of the new |
14 tasks
Member
Author
|
Perhaps #5747 is going to fix the failing boot tests? |
ab9de77 to
47a9964
Compare
Contributor
raymondfeng
requested changes
Jun 26, 2020
.mocharc.js
Outdated
| const defaultConfig = require('./packages/build/config/.mocharc.json'); | ||
|
|
||
| const MONOREPO_CONFIG = { | ||
| lang: 'en_US.UTF-8', |
Contributor
There was a problem hiding this comment.
lb-mocha won't be able to pick lang from mocha config.
package.json
Outdated
| "docs:prepare": "./docs/bin/build-preview-site.sh", | ||
| "docs:start": "cd docs/_preview && bundle exec jekyll serve --no-w --i", | ||
| "mocha": "node packages/build/bin/run-mocha --lang en_US.UTF-8 --timeout 5000 \"packages/*/dist/__tests__/**/*.js\" \"extensions/*/dist/__tests__/**/*.js\" \"examples/*/dist/__tests__/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"", | ||
| "mocha": "node packages/build/bin/run-mocha \"packages/*/dist/__tests__/**/*.js\" \"extensions/*/dist/__tests__/**/*.js\" \"examples/*/dist/__tests__/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"", |
Contributor
There was a problem hiding this comment.
We have to use --lang with the command.
47a9964 to
8b71b32
Compare
- Remove `timeout`, it should be aggregated from individual packages. At the moment, `packages/cli` is already setting timeout 5000ms. Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
8b71b32 to
2dc7a5d
Compare
raymondfeng
approved these changes
Jun 29, 2020
agnes512
approved these changes
Jun 30, 2020
hacksparrow
approved these changes
Jun 30, 2020
jannyHou
reviewed
Jun 30, 2020
2 tasks
bajtos
commented
Jul 13, 2020
| it('saves command metadata to .yo-rc.json', () => { | ||
| it('saves command metadata to .yo-rc.json', function () { | ||
| // This test can be slow under parallel mode | ||
| // eslint-disable-next-line @typescript-eslint/no-invalid-this |
Member
Author
There was a problem hiding this comment.
This is not ideal. I opened a PR to avoid eslint-disable-next-line, see #5925
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parallel: trueto monorepo's root mocha configThis pull request supersedes #5011. I am intentionally keeping this change small and enabling parallel test execution only when the tests are executed for the entire monorepo. We can discuss further improvements after this pull request is landed. (E.g. which packages should run tests in parallel when running
npm tfrom their package directory. At the moment, users can opt into parallel execution vianpm t -- -p).Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈