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 25.3 breaks VSCode debug run #1490

Closed
pburkindine opened this issue Apr 2, 2020 · 19 comments
Closed

ts-jest 25.3 breaks VSCode debug run #1490

pburkindine opened this issue Apr 2, 2020 · 19 comments

Comments

@pburkindine
Copy link

Issue :

Having to revert to ts-jest 25.2.1 because I receive this error when running tests for a specific file, despite blowing away node_modules:

Could not find source file: '/Users/pete.burkindine/git/ccxp/ccxp-client/node_modules/@ngrx/store/bundles/store.umd.js'.

The file is there and a normal run of ng test does not have the same issue.

Here is the command that was run (by VS code launch setup on a specific file):

cd /Users/pete.burkindine/git/ccxp/ccxp-client ; /Users/pete.burkindine/.nvm/versions/node/v12.13.1/bin/node --inspect-brk=3326 node_modules/.bin/jest libs/features/provider-compare/src/lib/components/provider-data/provider-data-row-header-set/provider-data-row-header-set.component.spec.ts --config /Users/pete.burkindine/git/ccxp/ccxp-client/.debug/jest.config.js --runInBand --runTestsByPath --detectOpenHandles

Here is the jest.config used by the debugger

module.exports = {
  rootDir: '../',
  globals: {
    'ts-jest': {
      stringifyContentPathRegex: '\\.html?$',
      tsConfig: '<rootDir>/.debug/tsconfig.spec.json',
      astTransformers: [
        'jest-preset-angular/build/InlineFilesTransformer',
        'jest-preset-angular/build/StripStylesTransformer'
      ]
    }
  },
  testEnvironment: 'jest-environment-jsdom-sixteen',
  preset: 'jest-preset-angular',
  testURL: 'http://localhost/',
  transform: {
    '^.+\\.(ts|html)$': 'ts-jest'
  },
  setupFiles: ['<rootDir>/tools/testing/setup/mapbox.setup.ts'],
  setupFilesAfterEnv: ['<rootDir>/.debug/test-setup.ts'],
  silent: false,
  transformIgnorePatterns: ['node_modules/(?!@ngrx)', '<rootDir>/dist/'],
  moduleNameMapper: {
    '^@ccxp-client/(.*)$': '<rootDir>/libs/$1/src/index.ts',
    '^@ccxp-client-testing/(.*)$': '<rootDir>/libs/$1/src/testing.ts',
    '^tools/(.*)$': '<rootDir>/tools/$1',
    '\\.svg$': 'identity-obj-proxy'
  }
};
@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 2, 2020

Hi, would you please help us by testing this tgz #1470 (comment)

Can be a duplicated issue with #1470

@ahnpnl ahnpnl added the 🤷‍♂️ Needs More Info waiting for more information from author of the issue label Apr 2, 2020
@pburkindine
Copy link
Author

@ahnpnl Unfortunately my network security prevents me from downloading the file; if you want to provide me with e.g. a dropbox link I will try that

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 2, 2020

@jsaguet
Copy link
Contributor

jsaguet commented Apr 2, 2020

I have the same kind of error:
Could not find source file: 'path\to\project\node_modules\lodash\index.js'.
I didn't have any issue with previous ts-jest version and your zip fixes the problem

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 2, 2020

the changes in zip file are in master now, will be in 25.3.1

@ahnpnl ahnpnl added 🐛 Bug Regression 💥 and removed 🤷‍♂️ Needs More Info waiting for more information from author of the issue 🐛 Bug labels Apr 2, 2020
@jsaguet
Copy link
Contributor

jsaguet commented Apr 2, 2020

Could you share which PR or commit fixed it please?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 2, 2020

#1483

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

Hi @pburkindine does the zip fix your problem ?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

25.3.1 is out, please check :)

@LasaleFamine
Copy link

LasaleFamine commented Apr 3, 2020

Hi @ahnpnl I'm here again 😄 I saw you mentioned the issue I had too, well I've updated to 25.3.1 and I'm getting another problem:

packages/progress/__tests__/Progress.spec.tsx
  ● Test suite failed to run

    TypeError: node_modules/@testing-library/jest-dom/extend-expect.js: Emit skipped for language service

      at compileFn (node_modules/ts-jest/dist/compiler/language-service.js:101:23)
      at Object.compile (node_modules/ts-jest/dist/compiler/instance.js:90:25)
      at TsJestTransformer.process (node_modules/ts-jest/dist/ts-jest-transformer.js:94:41)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:446:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:525:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:563:25)

Maybe this is related too, but I have made a try adding outDir: "$$ts-jest" and it's working again!

For completeness, here is my tsconfig.test.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "$$ts-jest",
    "skipLibCheck": true,
    "module": "esnext",
    "target": "es6",
    "lib": ["es6", "dom", "es2016", "esnext"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "declaration": false,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "esModuleInterop": true,
    "baseUrl": "./",
    "paths": {
      "jest-helpers/*": [".jest/*"]
    }
  }
}

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

seems like outDir is always required for allowJs. Internal ts-jest tests also require to set outDir. I have reverted #1472 because I thought #1483 make outDir not mandatory. PR is always welcome to help us if you think outDir is necessary to have.

Besides, how about performance comparing to 25.2.1 ?

@LasaleFamine
Copy link

LasaleFamine commented Apr 3, 2020

Same for me after first run re-creating caches.

UPDATE: you think #1472 can do the work?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

Same for me after first run re-creating caches.

UPDATE: you thing #1472 can do the work?

Glad to hear that performance goes back to be the same as 25.2.1

Yes #1472 is the same as you manually declare outDir in your tsconfig :)

@LasaleFamine
Copy link

Maybe it's worth to know if this solve the problem also for @pburkindine and @jsaguet before re-reverting the change.

@jsaguet
Copy link
Contributor

jsaguet commented Apr 3, 2020

25.3.1 fixes my issue

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

25.3.1 fixes my issue

Do you use outDir in your tsconfig ?

@jsaguet
Copy link
Contributor

jsaguet commented Apr 3, 2020

yes I do

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 4, 2020

Hi guys, I will close this since it is fixed with 25.3.1. For the issue with allowJs and emitSkip, please check #1500

Seems like #1472 is required to bring back.

@ahnpnl ahnpnl closed this as completed Apr 4, 2020
@pburkindine
Copy link
Author

@ahnpnl also fixed for me in 25.3.1, thanks for the prompt fix! :)

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

4 participants