You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When running jest test, breakpoint set on ts file doesn't get hit,
what I observe is debugger sometimes bring up another ts file (which looks like a generated file with the same file name) which seems to be a javascript file. since it is different file with the same name, line and columns are out of sync so, breakpoint either not work or broke into wrong place. it feels like some issue with sourcemap.
another weird thing to mention is vscode shows 2 editors with the same name as shown below. and debugger show one as short name and the other in full name. and one of them looks like javascript file (readonly) and the other original ts file. yet has same "ts" name.
This is because by default we'll only resolve sourcemaps for programs in the same package as the target file. This was added intentionally to avoid very long boot times in monorepos that might have lots of irrelevant packages.
To fix this, you can add "resolveSourceMapLocations": null (or use its default that globs the workspace folder) to have the debugger resolve sourcemaps everywhere.
Also, you can set breakpoints in the test files themselves with some quick changes to runner.ts:
diff --git a/packages/pyright/packages/pyright-internal/src/tests/harness/fourslash/runner.ts b/packages/pyright/packages/pyright-internal/src/tests/harness/fourslash/runner.ts
index a99b81e4..bb55b3fc 100644
--- a/packages/pyright/packages/pyright-internal/src/tests/harness/fourslash/runner.ts+++ b/packages/pyright/packages/pyright-internal/src/tests/harness/fourslash/runner.ts@@ -6,6 +6,7 @@
* Provide APIs to run fourslash tests from provided fourslash markup contents
*/
+import { dirname } from 'path';
import * as ts from 'typescript';
import { combinePaths } from '../../../common/pathUtils';
@@ -69,7 +70,8 @@ export function runFourSlashTestContent(
: new TestState(absoluteBasePath, testData, mountPaths, hostSpecificFeatures);
const output = ts.transpileModule(content, {
reportDiagnostics: true,
- compilerOptions: { target: ts.ScriptTarget.ES2015 },+ fileName,+ compilerOptions: { target: ts.ScriptTarget.ES2015, inlineSourceMap: true, sourceRoot: 'file:///' + dirname(fileName) },
});
if (output.diagnostics!.length > 0) {
throw new Error(`Syntax error in ${absoluteBasePath}: ${output.diagnostics![0].messageText}`);
note that because the script is eval'd, breakpoints will be off by a line (the debugger doesn't really know ahead of time whether the source map accounts for this, jest's do but tsc's don't), but it's a little better experience, perhaps. Also you may want to add windows handling to form the sourceRoot uri, that is just a quick hack to demo 😉
Describe the bug
When running jest test, breakpoint set on ts file doesn't get hit,
what I observe is debugger sometimes bring up another ts file (which looks like a generated file with the same file name) which seems to be a javascript file. since it is different file with the same name, line and columns are out of sync so, breakpoint either not work or broke into wrong place. it feels like some issue with sourcemap.
another weird thing to mention is vscode shows 2 editors with the same name as shown below. and debugger show one as short name and the other in full name. and one of them looks like javascript file (readonly) and the other original ts file. yet has same "ts" name.
To Reproduce
Steps to reproduce the behavior:
expected behavior:
breakpoint hit
actual behavior:
no breakpoint gets hit.
Log File
vscode-debugadapter-64bf200a.json.gz
VS Code Version: v1.61.0
** JavaScript debugger (nightly) ** v2021.10.1317
Additional context
it repro with built-in version as well.
The text was updated successfully, but these errors were encountered: