diff --git a/tests/specs/run/sourcemap_nonexistent_source/__test__.jsonc b/tests/specs/run/sourcemap_nonexistent_source/__test__.jsonc index 8b18f886d9..711b238f7d 100644 --- a/tests/specs/run/sourcemap_nonexistent_source/__test__.jsonc +++ b/tests/specs/run/sourcemap_nonexistent_source/__test__.jsonc @@ -1,6 +1,14 @@ { - "ignore": true, - "args": "run bundle.js", - "output": "bundle.js.out", - "exitCode": 1 + "tests": { + "node_modules": { + "args": "run --allow-read node_modules.ts", + "output": "node_modules.out", + "exitCode": 1 + }, + "not_node_modules": { + "args": "run not_node_modules.js", + "output": "not_node_modules.out", + "exitCode": 1 + } + } } diff --git a/tests/specs/run/sourcemap_nonexistent_source/bundle.js.map b/tests/specs/run/sourcemap_nonexistent_source/bundle.js.map deleted file mode 100644 index 915fc0c910..0000000000 --- a/tests/specs/run/sourcemap_nonexistent_source/bundle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,SAAS,UAAU;IACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED,UAAU,EAAE,CAAC"} diff --git a/tests/specs/run/sourcemap_nonexistent_source/bundle.js.out b/tests/specs/run/sourcemap_nonexistent_source/bundle.js.out deleted file mode 100644 index 31d7fd59f6..0000000000 --- a/tests/specs/run/sourcemap_nonexistent_source/bundle.js.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) Error: Test error from bundle with missing source - throw new Error("Test error from bundle with missing source"); - ^ - at throwError ([WILDCARD]bundle.js:3:3) - at [WILDCARD]bundle.js:6:14 diff --git a/tests/specs/run/sourcemap_nonexistent_source/deno.json b/tests/specs/run/sourcemap_nonexistent_source/deno.json new file mode 100644 index 0000000000..fde86a1efb --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "manual" +} diff --git a/tests/specs/run/sourcemap_nonexistent_source/node_modules.out b/tests/specs/run/sourcemap_nonexistent_source/node_modules.out new file mode 100644 index 0000000000..ccc14495b5 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/node_modules.out @@ -0,0 +1,3 @@ +error: Uncaught (in promise) Error: Test error from npm bundle with missing source + at throwError ([WILDCARD]node_modules/test-pkg/bundle.js:3:9) + at [WILDCARD]node_modules.ts:3:1 diff --git a/tests/specs/run/sourcemap_nonexistent_source/node_modules.ts b/tests/specs/run/sourcemap_nonexistent_source/node_modules.ts new file mode 100644 index 0000000000..ef71087b30 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/node_modules.ts @@ -0,0 +1,3 @@ +import { throwError } from "test-pkg"; + +throwError(); diff --git a/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js new file mode 100644 index 0000000000..e68cd1677d --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js @@ -0,0 +1,8 @@ +// Simulates an npm package bundle where source files don't exist +function throwError() { + throw new Error("Test error from npm bundle with missing source"); +} + +module.exports = { throwError }; + +//# sourceMappingURL=bundle.js.map diff --git a/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js.map b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js.map new file mode 100644 index 0000000000..622a44b386 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,SAAS,UAAU;IACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAChE,CAAC;AAED,OAAO,CAAC,OAAO,GAAG,EAAE,UAAU,EAAE,CAAC"} diff --git a/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/package.json b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/package.json new file mode 100644 index 0000000000..f04f163917 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/package.json @@ -0,0 +1,5 @@ +{ + "name": "test-pkg", + "version": "1.0.0", + "main": "bundle.js" +} diff --git a/tests/specs/run/sourcemap_nonexistent_source/bundle.js b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js similarity index 79% rename from tests/specs/run/sourcemap_nonexistent_source/bundle.js rename to tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js index 3ab5990791..88fe0e8282 100644 --- a/tests/specs/run/sourcemap_nonexistent_source/bundle.js +++ b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js @@ -5,4 +5,4 @@ function throwError() { throwError(); -//# sourceMappingURL=bundle.js.map +//# sourceMappingURL=not_node_modules.js.map diff --git a/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js.map b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js.map new file mode 100644 index 0000000000..8a686adf27 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.js.map @@ -0,0 +1 @@ +{"version":3,"file":"not_node_modules.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,SAAS,UAAU;IACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED,UAAU,EAAE,CAAC"} diff --git a/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.out b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.out new file mode 100644 index 0000000000..86795f0b71 --- /dev/null +++ b/tests/specs/run/sourcemap_nonexistent_source/not_node_modules.out @@ -0,0 +1,3 @@ +error: Uncaught (in promise) Error: Test error from bundle with missing source + at throwError ([WILDCARD]src/index.ts:3:3) + at [WILDCARD]src/index.ts:6:14