Skip to content

ts-jest with cleared cache is reading package.json in node_modules over and over - start takes forever #16703

Closed
@Farbdose

Description

@Farbdose

Bug Report

I just updated to ts-jest@23.10.5 from somewhere around ~23.1.3 which increased the runtime of my test suite from 10ish seconds [on the first run / with cleared cache] to over 40 seconds - with cache around 2.5s.

It's possible that this is a ts-jest (or even typescript) issue BUT after I created a demo-repository I realized that the problem went away after I removed ionic from the project.
So ionic probably has something to do with it.

Ionic version:

[x] 4.x

Current behavior:
The initial start of jest takes around 30 seconds on an almost empty repository with ionic included.

Expected behavior:
The initial start of jest shouldn't take that long.

Steps to reproduce:

  • Have js files that need to be processed by ts-jest (as they contain import statements) being present in one of the modules you import
  • have ts-jest@>=23.10.1
  • import the IonicModule in one of you angular modules

Related code:
https://gitlab.com/Farbdose/ts-jest-multiple-fileread

git clone git@gitlab.com:Farbdose/ts-jest-multiple-fileread.git
npm install && npm run test

Other information:

You can find the original issue at kulshekhar/ts-jest#908
Possibly related #15695: I had to use the fix described there to actually get jest running at all.

Ionic info:

[WARN] You are not in an Ionic project directory. Project context may be missing.

Ionic:

   ionic (Ionic CLI) : 4.3.1

System:

   NodeJS : v8.11.2
   npm    : 6.1.0
   OS     : Linux 4.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions