Skip to content

Commit

Permalink
[ci] Improve parallelism of yarn test
Browse files Browse the repository at this point in the history
Changes the `ci` argument to be an enum instead so the tests use all
available workers in GitHub actions.

- When `ci === 'github'` also increase maxConcurrency to 10
- Increase timeout of ReactMultiChildText-test.js

ghstack-source-id: f8dee9a6e859d1e9544f870277de231e2b7a9261
Pull Request resolved: #30033
  • Loading branch information
poteto committed Jun 21, 2024
1 parent 650763a commit 4de6b07
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ jobs:
steps:
- checkout
- setup_node_modules
- run: yarn test <<parameters.args>> --ci
- run: yarn test <<parameters.args>> --ci=circleci

yarn_test_build:
docker: *docker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/runtime_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
path: "**/node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn test ${{ matrix.params }} --ci
- run: yarn test ${{ matrix.params }} --ci=github
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const expectChildren = function (container, children) {
* faster to render and update.
*/
describe('ReactMultiChildText', () => {
jest.setTimeout(20000);
jest.setTimeout(30000);

it('should correctly handle all possible children for render and update', async () => {
await expect(async () => {
Expand Down
10 changes: 7 additions & 3 deletions scripts/jest/jest-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const argv = yargs
ci: {
describe: 'Run tests in CI',
requiresArg: false,
type: 'boolean',
default: false,
type: 'choices',
choices: ['circleci', 'github'],
},
compactConsole: {
alias: 'c',
Expand Down Expand Up @@ -309,10 +309,14 @@ function getCommandArgs() {
}

// CI Environments have limited workers.
if (argv.ci) {
if (argv.ci === 'circleci') {
args.push('--maxWorkers=2');
}

if (argv.ci === 'github') {
args.push('--maxConcurrency=10 --workerThreads=true');
}

// Push the remaining args onto the command.
// This will send args like `--watch` to Jest.
args.push(...argv._);
Expand Down

0 comments on commit 4de6b07

Please sign in to comment.