Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
"skipFiles": [
"<node_internals>/**/*.js"
],
},
{
"name": "Debug Example: running a test fixture against local ts-node/esm loader",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}/tests/esm",
"runtimeArgs": ["--loader", "../../ts-node/esm"],
"program": "throw error.ts",
"outputCapture": "std",
"skipFiles": [
"<node_internals>/**/*.js"
],
}
],
}
41 changes: 36 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
}
},
"dependencies": {
"@cspotcode/source-map-support": "0.7.0",
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
"@tsconfig/node12": "^1.0.7",
"@tsconfig/node14": "^1.0.0",
Expand Down
12 changes: 7 additions & 5 deletions src/test/esm-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,24 @@ test.suite('esm', (test) => {
expect(err).toBe(null);
expect(stdout).toBe('foo bar baz biff libfoo\n');
});
test('should use source maps', async () => {
const { err, stdout } = await exec(
test('should use source maps', async (t) => {
const { err, stdout, stderr } = await exec(
`${CMD_ESM_LOADER_WITHOUT_PROJECT} "throw error.ts"`,
{
cwd: join(TEST_DIR, './esm'),
}
);
expect(err).not.toBe(null);
const expectedModuleUrl = pathToFileURL(
join(TEST_DIR, './esm/throw error.ts')
).toString();
expect(err!.message).toMatch(
[
`${pathToFileURL(join(TEST_DIR, './esm/throw error.ts'))
.toString()
.replace(/%20/g, ' ')}:100`,
`${expectedModuleUrl}:100`,
" bar() { throw new Error('this is a demo'); }",
' ^',
'Error: this is a demo',
` at Foo.bar (${expectedModuleUrl}:100:17)`,
].join('\n')
);
});
Expand Down