1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-23 00:25:04 +01:00

Improve jest performance (#9496)

Utilizing resources based on thread availability improves performance vs fixed threading.

The linked issue for CI crashes has not been closed. Once this is solves, `runInBand` may improves performance in CI.
This commit is contained in:
Matt Gibson 2024-06-04 10:40:41 -04:00 committed by GitHub
parent 1bf3a4b6eb
commit 490e6c322d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -48,10 +48,12 @@ jobs:
# Tests in apps/ are typechecked when their app is built, so we just do it here for libs/
# See https://bitwarden.atlassian.net/browse/EC-497
- name: Run typechecking
run: npm run test:types --coverage
run: npm run test:types
- name: Run tests
run: npm run test --coverage
# maxWorkers is a workaround for a memory leak that crashes tests in CI:
# https://github.com/facebook/jest/issues/9430#issuecomment-1149882002
run: npm test -- --coverage --maxWorkers=3
- name: Report test results
uses: dorny/test-reporter@eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8 # v1.8.0

View File

@ -11,10 +11,8 @@ module.exports = {
".*.type.spec.ts", // ignore type tests (which are checked at compile time and not run by jest)
],
// Workaround for a memory leak that crashes tests in CI:
// https://github.com/facebook/jest/issues/9430#issuecomment-1149882002
// Also anecdotally improves performance when run locally
maxWorkers: 3,
// Improves on-demand performance, for watches prefer 25%, overridable by setting --maxWorkers
maxWorkers: "50%",
transform: {
"^.+\\.(ts|js|mjs|svg)$": [