Conversation
@@ -0,0 +1,37 @@ | |||
// This Source Code Form is subject to the terms of the Mozilla Public |
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.
maybe throw this in packages?
@@ -25,8 +25,8 @@ | |||
}, | |||
"devDependencies": { | |||
"@jest/types": "26.6.2", | |||
"jest": "26.6.3", | |||
"jest-circus": "26.6.3", | |||
"jest": "27.0.0-next.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.
drop this in favor of just having it listed in repo root?
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.
@amacneil thoughts on this after your excursions in packaging setup?
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.
I haven't done my package.json cleanup yet, but jest and typescript should be listed in each package.json so that we can individually run yarn test
(or yarn jest
) from inside these packages.
Are test files still being type checked in CI now? |
Some are, like the ones in |
On my M1 MacBook Air I can now run all the tests in about 16 seconds. Running a single small test file is down from 15sec to <2sec.
There were a few components to this:
jest.config.ts
files (Jest spends several seconds inloadTSConfigFile
before running tests jestjs/jest#11337). Fixed by replacing them withjest.config.json
files.find
if available over node fs, but it doesn't pass any exclude options to find, which means that it has to wait a few seconds forfind
, then filter a huge list of all .js files in app/node_modules. Upgrading jest lets us pass a config option to force it to use node fs instead (feat(config): allow passing option to force node crawl jestjs/jest#11264 (comment)).jsdom
is no longer the default environment in jest, and there is some overhead to jsdom. We are embracing this change by only enabling jsdom in certain test files that need it. Unfortunately Jest only recognizes the/** @jest-environment jsdom */
comment if it is at the very beginning of the file, so I had to replace our eslint-plugin-header rule with a custom rule to enforce the presence of license headers.?raw
transformer to .js instead of .ts, since we are not using ts-node anymore.isolatedModules
in tsconfig.) For better or worse, our regular webpack build already typechecks our test files.Before:
After: