Skip to content
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

ts-jest transform cache causes memory leak when using multiple processes in CI #442

Open
cangarugula opened this issue Jun 7, 2021 · 2 comments

Comments

@cangarugula
Copy link
Contributor

This issue is discussed here: kulshekhar/ts-jest#1967

When running tests with multiple processes (maxWorkers > 1), ts-jest caches transformed results multiple times, resulting in a memory leak issue. The failure occurs in a CI pipeline with these errors:

Screen Shot 2021-06-07 at 6 28 20 AM

Screen Shot 2021-06-07 at 6 27 10 AM

The tests that fail due to memory issues do not stay consistent when running with workers.

While these errors don't show locally, when logging heap usage, you can see that each test has an increased heap size. Here is a sample of heap size logs:

Screen Shot 2021-06-07 at 6 46 25 AM

@desaijay315
Copy link

desaijay315 commented Sep 28, 2022

Hey @cangarugula, Would be curious to know, if have you tried with jest CLI flag runInBand ??

Can we have something where we can transpile from TSX to js before running the test, then this would too speed up the test cases execution.

isolatedModules being set to true will fix a memory leak in ts-jest. However, type checking will not be performed whilst running tests (will still have type checking when writing tests)

globals: {
    'ts-jest': {
      isolatedModules: true,
    },
  },

@sgb-io
Copy link
Contributor

sgb-io commented Apr 18, 2023

cc @AlbertoBrusa @cristiano-belloni this issue might go away with the planned swc changes? Also, I'm unsure if this issue still exists today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants