Skip to content

Reproducing bug with incorrect line numbers output from `ts-jest` with `collectCoverage: true`

Notifications You must be signed in to change notification settings

wesleygrimes/ts-jest-coverage-incorrect-line-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-jest-coverage-incorrect-line-numbers

Having an issue when running yarn test with jest.config.js collectCoverage: true. The line number and stack reported are incorrect.

Actual Output:

$ jest
 FAIL  src/foo.test.ts
  ✕ will it blow up? (4ms)

  ● will it blow up?

    Uh oh!



      at Object.ifCalledWillBlowUp (src/foo.ts:100:9)
      at Object.<anonymous> (src/foo.test.ts:4:3)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        1.591s
Ran all test suites.
error Command failed with exit code 1.

Expected Output:

$ jest
 FAIL  src/foo.test.ts
  ✕ will it blow up? (4ms)

  ● will it blow up?

    Uh oh!

      1 | export function ifCalledWillBlowUp() {
    > 2 |   throw new Error('Uh oh!');
        |         ^
      3 | }
      4 |

      at Object.ifCalledWillBlowUp (src/foo.ts:2:9)
      at Object.<anonymous> (src/foo.test.ts:4:3)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        1.424s
Ran all test suites.
error Command failed with exit code 1.

Reproducing Issue

Issue can be reproduced running yarn test or npm run test

Env Info

// package.json
{
  "@types/jest": "^24.0.15",
  "jest": "^24.8.0",
  "ts-jest": "^24.0.2",
  "typescript": "^3.5.3"
}

Related GitHub Issues

About

Reproducing bug with incorrect line numbers output from `ts-jest` with `collectCoverage: true`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published