Skip to content

Commit 17aad13

Browse files
authored
Switch to new @cspotcode/source-map-support, using trace-mapping (#1729)
* WIP * stuff * fix * experimenting * try new changes * fix * update * bump * fix * bump * bump * fix * bump * cleanup
1 parent 9e25557 commit 17aad13

File tree

4 files changed

+56
-11
lines changed

4 files changed

+56
-11
lines changed

.vscode/launch.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
"skipFiles": [
1212
"<node_internals>/**/*.js"
1313
],
14+
},
15+
{
16+
"name": "Debug Example: running a test fixture against local ts-node/esm loader",
17+
"type": "pwa-node",
18+
"request": "launch",
19+
"cwd": "${workspaceFolder}/tests/esm",
20+
"runtimeArgs": ["--loader", "../../ts-node/esm"],
21+
"program": "throw error.ts",
22+
"outputCapture": "std",
23+
"skipFiles": [
24+
"<node_internals>/**/*.js"
25+
],
1426
}
1527
],
1628
}

package-lock.json

Lines changed: 36 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
}
158158
},
159159
"dependencies": {
160-
"@cspotcode/source-map-support": "0.7.0",
160+
"@cspotcode/source-map-support": "^0.8.0",
161161
"@tsconfig/node10": "^1.0.7",
162162
"@tsconfig/node12": "^1.0.7",
163163
"@tsconfig/node14": "^1.0.0",

src/test/esm-loader.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,24 @@ test.suite('esm', (test) => {
4848
expect(err).toBe(null);
4949
expect(stdout).toBe('foo bar baz biff libfoo\n');
5050
});
51-
test('should use source maps', async () => {
52-
const { err, stdout } = await exec(
51+
test('should use source maps', async (t) => {
52+
const { err, stdout, stderr } = await exec(
5353
`${CMD_ESM_LOADER_WITHOUT_PROJECT} "throw error.ts"`,
5454
{
5555
cwd: join(TEST_DIR, './esm'),
5656
}
5757
);
5858
expect(err).not.toBe(null);
59+
const expectedModuleUrl = pathToFileURL(
60+
join(TEST_DIR, './esm/throw error.ts')
61+
).toString();
5962
expect(err!.message).toMatch(
6063
[
61-
`${pathToFileURL(join(TEST_DIR, './esm/throw error.ts'))
62-
.toString()
63-
.replace(/%20/g, ' ')}:100`,
64+
`${expectedModuleUrl}:100`,
6465
" bar() { throw new Error('this is a demo'); }",
6566
' ^',
6667
'Error: this is a demo',
68+
` at Foo.bar (${expectedModuleUrl}:100:17)`,
6769
].join('\n')
6870
);
6971
});

0 commit comments

Comments
 (0)