-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: enable parallel execution of Mocha tests #5831
Conversation
@raymondfeng Few booter tests are failing in parallel mode, can you PTAL? You can reproduce the problem on $ npm run mocha -- --parallel It would be great to fix the problem in a new pull request and then rebase this pull request on top of the new |
Perhaps #5747 is going to fix the failing boot tests? |
ab9de77
to
47a9964
Compare
.mocharc.js
Outdated
@@ -6,8 +6,14 @@ | |||
const {mergeMochaConfigs} = require('./packages/build'); | |||
const defaultConfig = require('./packages/build/config/.mocharc.json'); | |||
|
|||
const MONOREPO_CONFIG = { | |||
lang: 'en_US.UTF-8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lb-mocha
won't be able to pick lang
from mocha config.
package.json
Outdated
@@ -69,7 +69,7 @@ | |||
"build:site": "./bin/build-docs-site.sh", | |||
"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\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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š <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
8b71b32
to
2dc7a5d
Compare
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal. I opened a PR to avoid eslint-disable-next-line
, see #5925
parallel: true
to 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 t
from 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 test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈