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
The debugger doesn't stop at debugger; statement in VSCode with TypeScript compilerOptions.target="es2017" #299
Comments
The problem appears to be with sourceMaps. The code is transformed in Jest here const processed = transform.process(content, filename, this._config, {
instrument,
}); And the sourceMaps are created here const inlineSourceMap = convertSourceMap.fromSource(transformed.code); For file SystemUnderTest.test.js in my repro project, the processed code is 'use strict';require('ts-jest').install();"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const SystemUnderTest_1 = require("../SystemUnderTest");
describe("Testing", () => {
it("testing odd number", async () => {
debugger;
const output = await SystemUnderTest_1.oddOrEven(3);
expect(output).toEqual("odd");
});
it("testing even number", async () => {
debugger;
const output = await SystemUnderTest_1.oddOrEven(2);
expect(output).toEqual("even");
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3lzdGVtVW5kZXJUZXN0LnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvX190ZXN0c19fL1N5c3RlbVVuZGVyVGVzdC50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsd0RBQStDO0FBRS9DLFFBQVEsQ0FBQyxTQUFTLEVBQUU7SUFDbEIsRUFBRSxDQUFDLG9CQUFvQixFQUFFLEtBQUs7UUFDNUIsUUFBUSxDQUFDO1FBQ1QsTUFBTSxNQUFNLEdBQUcsTUFBTSwyQkFBUyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2xDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDaEMsQ0FBQyxDQUFDLENBQUM7SUFFSCxFQUFFLENBQUMscUJBQXFCLEVBQUUsS0FBSztRQUM3QixRQUFRLENBQUM7UUFDVCxNQUFNLE1BQU0sR0FBRyxNQUFNLDJCQUFTLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDbEMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNqQyxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0= And the sourceMap is: {
"version": 3,
"file": "SystemUnderTest.test.js",
"sourceRoot": "",
"sources": [
"../src/__tests__/SystemUnderTest.test.ts"
],
"names": [],
"mappings": ";;AAAA,wDAA+C;AAE/C,QAAQ,CAAC,SAAS,EAAE;IAClB,EAAE,CAAC,oBAAoB,EAAE,KAAK;QAC5B,QAAQ,CAAC;QACT,MAAM,MAAM,GAAG,MAAM,2BAAS,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,KAAK;QAC7B,QAAQ,CAAC;QACT,MAAM,MAAM,GAAG,MAAM,2BAAS,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"
} This seems to be an issue with sourceMaps since:
Do I need to pass any special parameter for Jest? I'm already passing |
The issue was fixed and verified in this commit in a private branch The solution was to add inlineSourceMap and inlineSources instead of sourceMap in tsconfig.json as follows: - "sourceMap": true
+ "inlineSourceMap": true,
+ "inlineSources": true This issue appears to be with NodeJS v8.4.0 and doesn't depend on value passed to compilerOptions. Keeping the issue open, so that documentation can be added in README.md explaining this issue. |
@trivikr this is weird. We're already setting |
Still, we might want to note this in the readme. |
The contents of result in getTSConfig(): Line 230 in d8e03d6
With inlineSourceMap: true, inlineSources: true, sourceMap: undefined: {"target":4,"module":1,"moduleResolution":2,"inlineSourceMap":true,"inlineSources":true,"jsx":2} With inlineSourceMap: undefined, inlineSources: undefined, sourceMap: true: {"target":4,"module":1,"moduleResolution":2,"inlineSourceMap":true,"inlineSources":true,"jsx":2} So, the issue doesn't seem to be with getTSConfig() function. |
The contents of modified are different in function process() at Line 68 in a413a04
With inlineSourceMap: undefined, inlineSources: undefined, sourceMap: true With inlineSourceMap: true, inlineSources: true, sourceMap: undefined: The sourceMappingUrl is different |
Issue: parameter inlineSources is not set to true when it's not explicitly defined in compilerOptions Lines 18 to 21 in a413a04
This happens when you place debug points in preprocessor.ts Looks like this difference is because of tsConfigCacheKey: Lines 156 to 163 in a413a04
My repro repository does pass parameters --runInBand and --no-cache while debugging tests in VSCode in launch.json |
@trivikr this has been fixed in 20.0.13. Could you confirm that this works for you? |
Thank you @kulshekhar for taking up this bug fix. This issue can be closed. |
@trivikr I'm testing vscode debug as well and found that there is no need for |
@tkrotoff Yes, you're right. The repro repo ts-jest-es2017-debugger-repro just tests for test files and not build files. So, file I was pulling the newest version of dependencies in my repo. I've changed it to pull specific versions so that bug will be reproducible in master branch of the repo. |
As suggested by @tkrotoff I removed the commands unrelated to bug repro in this commit |
Issue [FIXED - view comment]
The debugger doesn't stop at debugger; statement in VSCode with Typescript compilerOptions.target="es2017"
Expected behavior
The debugger should stop at debugger; in VSCode
Link to a minimal repo that reproduces this issue
ts-jest-es2017-debugger-repro
Is this an issue with my settings?
The text was updated successfully, but these errors were encountered: