question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ts-jest 25.3 breaks VSCode debug run

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19

github_iconTop GitHub Comments

1reaction
jsaguetcommented, 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

0reactions
pburkindinecommented, Apr 4, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code won't properly step on TypeScript code
Set a breakpoint on line 23 of hey.ts (first instruction of barFunction() ), the debugger will stop there, but if you step in...
Read more >
Debugging with TypeScript, Jest, ts-jest and Visual Studio Code
I've been working on a TypeScript project where I'm using jest . I'm super happy with TypeScript and Jest and with ts-jest ,...
Read more >
@jest/globals | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Debugging Jest with while --coverage enabled results in ...
We use jest with TS (via ts-jest). When I try to debug code ... Navigate to the line 671 and put break point...
Read more >
Vsc, Visual Studio Code - Extensions - infos
Makes it easy to create, manage, and debug containerized applications. FREE. Java Test Runner 5M Microsoft Run and debug JUnit or TestNG test ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found