ts-jest: ts-jest 25.3 breaks VSCode debug run

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'
  }
};

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19

Most upvoted comments

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