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

Diagnostics Uses a Huge Amount of Memory #479

Closed
mattyclarkson opened this issue Apr 3, 2018 · 6 comments
Closed

Diagnostics Uses a Huge Amount of Memory #479

mattyclarkson opened this issue Apr 3, 2018 · 6 comments
Milestone

Comments

@mattyclarkson
Copy link

  • Issue

Running the tests without a populated cache uses a huge amount of memory and time. I am seeing >2mins vs 10seconds on ef-carbon/dom

It seems the first workers that spawn crush somehow. Notice that the first 8 tests took 80seconds and then the rest passed in a few seconds.

 PASS  test/visit.test.ts (79.523s)
 PASS  test/node/Audio.test.ts (79.62s)
 PASS  test/node/Container.test.ts (79.799s)
 PASS  test/node/Video.test.ts (80.375s)
 PASS  test/node/Scrollable.test.ts (80.874s)
 PASS  test/node/Modal.test.ts (81.261s)
 PASS  test/walk.test.ts (81.819s)
 PASS  test/node/Text.test.ts
 PASS  test/node/Link.test.ts
 PASS  test/node/Span.test.ts
 PASS  test/node/Padding.test.ts
 PASS  test/node/List.test.ts
 PASS  test/node/Heading.test.ts
 PASS  test/node/Carousel.test.ts
 PASS  test/node/Image.test.ts
 PASS  test/node/Quote.test.ts
 PASS  test/node/Code.test.ts
 PASS  test/node/Separator.test.ts
  • Expected behavior

That the diagnostics should add a small overhead

  • Output from your debug log
    [ You can activate the debug logger by setting the environment variable TS_JEST_DEBUG="true" before running yarn test. The output of the logger
    will be in <your_project_dir>/node_modules/ts-jest/debug.txt ]

debug.txt

  • Link to a minimal repo that reproduces this issue
$ git clone https://github.com/ef-carbon/dom.git
$ yarn install
$  # Run tests with diagnostics (~4mins)
$ yarn test --clearCache
$ yarn test
$ jq '.jest.globals["ts-jest"].enableTsDiagnostics = false' < package.json > package.json~
$ mv package.json{~,}
$  # Run tests without diagnostics (~10secs)
$ yarn test --cleanCache
$ yarn test
@kulshekhar
Copy link
Owner

kulshekhar commented Apr 5, 2018

I'm not sure what the cause of this could be - mostly because I never use diagnostics with ts-jest (I run diagnostics during dev and in the CI process). This feature was only added because a lot of folks wanted it.

That said, if you can create a minimal repo that reproduces this, I'll take a look at this when I next have some time using the repo you've linked to

@kulshekhar
Copy link
Owner

I've just taken a look at this and I'm not sure there's anything that can be done in ts-jest to fix this.

A better option might be to to run check for type errors separately (that's what I personally do).

@mattyclarkson
Copy link
Author

We actually run tslint and tsc with strict checks. I've now disabled the diagnostics on our CI. They still pick up things locally that the other two don't, somehow.

@kulshekhar
Copy link
Owner

They still pick up things locally that the other two don't, somehow.

I'm not sure I understand 😕
If anything, I'd expect ts-jest's output (diagnostic related) to be a subset of what tsc would show

@kulshekhar
Copy link
Owner

I've added an additional note related to this: https://github.com/kulshekhar/ts-jest#ts-compiler--error-reporting

That doesn't solve this problem but it has been put there to make users aware of the issue in advance. Ideally, type errors should be checked in a different step and not as part of testing.

@huafu
Copy link
Collaborator

huafu commented Sep 2, 2018

You can try beta version which addresses this issue (see #697). Don't forget to activate type-checking and other diagnostic relevant options. They are not documented yet in beta, but here is something that might help until then (jest.globals.ts-jest config)

Update: Type-checking is enabled by default now. See readme for the link to documentation.

@huafu huafu added this to the v23.10.0 milestone Sep 19, 2018
@huafu huafu closed this as completed Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants