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
Chore: upgrade jest to latest version #1210
Comments
After upgrading to version 27 (current is 26) I am getting warning about multiple configs |
There is a fatal error after upgrade to 27 Error log
Error: ● Invalid transformer module:
"barista/node_modules/ts-jest/dist/index.js" specified in the "transform" object of Jest configuration
must export a `process` or `processAsync` or `createTransformer` function.
Code Transformation Documentation:
https://jestjs.io/docs/code-transformation
at barista/node_modules/@jest/transform/build/ScriptTransformer.js:387:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 1)
at async ScriptTransformer.loadTransformers (barista/node_modules/@jest/transform/build/ScriptTransformer.js:379:5)
at async createScriptTransformer (barista/node_modules/@jest/transform/build/ScriptTransformer.js:1113:3)
at async barista/node_modules/@jest/core/build/TestScheduler.js:269:31
at async Promise.all (index 0)
at async TestScheduler.scheduleTests (barista/node_modules/@jest/core/build/TestScheduler.js:262:5)
at async runJest (barista/node_modules/@jest/core/build/runJest.js:404:19) |
Upgrading |
After quick debugging, issue with transformer points |
Upgrading |
Attempting to resolve it by upgrading |
The error was resolved by upgrading |
To keep git history sane, I have rolled back (
|
Noticed this warning from ts-jest[versions] (WARN) Version 27.5.1 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=29.0.0 <30.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions. |
After upgrade, running unit tests leads to a memory leak and a system overload/halt. |
Need to investigate transformer related error Error log
● Invalid return value:
`process()` or/and `processAsync()` method of code transformer found at
"barista/config/jest/cssTransform.js"
should return an object or a Promise resolving to an object. The object
must have `code` property with a string of processed code.
This error may be caused by a breaking change in Jest 28:
https://jestjs.io/docs/28.x/upgrading-to-jest28#transformer
Code Transformation Documentation:
https://jestjs.io/docs/code-transformation |
After fixing transformers due to breaking change in version 28.x (source), I need to address a new issue: |
Running a primitive test like below succeeds it('potato', () => {
expect(true).toBe(true);
}; |
Looks like yarn version 1.19+ has issues with workspaces as described here. Workaround is to use version 1.19 via |
Now I am facing another error: |
Bizarre error gone after reinstalled |
😎 update from local machine 🚀 Test Suites: 238 passed, 238 total
Tests: 1247 passed, 1247 total
Snapshots: 0 total
Time: 330.579 s
Ran all test suites.
Done in 337.46s.
|
PR test failed due to memory exhaustion (error follows). On my local machine, the memory usage is close to 8GB whereas GitHub Action runners only have 7GB source. FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory |
For comparison, here's run from local machine: Test Suites: 237 passed, 237 total
Tests: 1245 passed, 1245 total
Snapshots: 0 total
Time: 456.24 s
Ran all test suites.
Edit: running Test Suites: 237 passed, 237 total
Tests: 1245 passed, 1245 total
Snapshots: 0 total
Time: 321.218 s, estimated 1802 s
Ran all test suites.
Done in 329.68s. TODO: use |
Using |
For some reason, experienced same memory related issue locally even though memory usage was <20% FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory |
Change branch base from |
Changed |
🔥 Results after running unit tests with type checking set to on 🚀 Test Suites: 236 passed, 236 total
Tests: 1249 passed, 1249 total
Snapshots: 0 total
Time: 479.306 s
Ran all test suites.
Done in 487.35s. A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them. Ps. no idea why number of tests run keep varying by 2-3 units. Edit: To find the memory leak, I have disabled source maps in Edit: After re-enabling source maps, the run has almost immediately crashed locally with the same memory error. Looks like I will have to make a factory for TS config to conditionally enable source maps since I need them to enable debugging. |
Will try to narrow down where the leak happens since GitHub Actions just crashed again with the memory error
Edit: running these separately did NOT reveal where memory leak happens |
It appears that memory related error is caused by |
It appears memory related information is somehow related to cache but it does not explain why it happens on GitHub Actions where there is no cache in the first place |
Disabling |
Memory issue could be related to generation of source maps, though I am unable to establish clear cause-and-effect chain Edit: I was able to successfully establish co-relation between source maps and jest memory-related errors locally |
So in the end it appears indeed a memory issue. By restricting memory allocation to 4GB (4096MB), I am able to successfully run all tests thanks to this comment. Documentation for this command is available here. The memory issue is known to Jest ticket, however it is still not yet resolved. Everyone's workaround is different. The issue is available here. |
Locally, I am able to run the tests with the following command: NODE_OPTIONS="--max-old-space-size=4096" yarn jest --verbose --maxWorkers=4 --maxConcurrency=2 |
Curios observation when running the command below yarn jest --maxWorkers=2 --maxConcurrency=2 --forceExit Test Suites: 236 passed, 236 total
Tests: 1249 passed, 1249 total
Snapshots: 0 total
Time: 256.018 s
Ran all test suites.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?
Done in 262.94s. Edit: perhaps cache from previous semi-finished run is responsible for such dramatic time reduction |
Once PR #1211 is closed, this issue can be closed as well |
As a part of getting E2E functional, I am going to upgrade jest to latest version to address performance issues.
The text was updated successfully, but these errors were encountered: