mirror of
https://github.com/denoland/deno.git
synced 2025-12-23 08:48:24 +00:00
tests: update sourcemap tests for npm-only source existence check (#31601)
Update the sourcemap_nonexistent_source test expectation to reflect that source file existence is only checked for npm packages (for performance). Add sourcemap_npm_nonexistent_source test to cover the npm package case where source maps reference non-existent files and should fall back to showing the bundle file path in stack traces.
This commit is contained in:
parent
783829a882
commit
efea61e1bc
12 changed files with 40 additions and 11 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
|
|
@ -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
|
||||
3
tests/specs/run/sourcemap_nonexistent_source/deno.json
Normal file
3
tests/specs/run/sourcemap_nonexistent_source/deno.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"nodeModulesDir": "manual"
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { throwError } from "test-pkg";
|
||||
|
||||
throwError();
|
||||
8
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js
generated
vendored
Normal file
8
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js
generated
vendored
Normal file
|
|
@ -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
|
||||
1
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js.map
generated
vendored
Normal file
1
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/bundle.js.map
generated
vendored
Normal file
|
|
@ -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"}
|
||||
5
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/package.json
generated
vendored
Normal file
5
tests/specs/run/sourcemap_nonexistent_source/node_modules/test-pkg/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "test-pkg",
|
||||
"version": "1.0.0",
|
||||
"main": "bundle.js"
|
||||
}
|
||||
|
|
@ -5,4 +5,4 @@ function throwError() {
|
|||
|
||||
throwError();
|
||||
|
||||
//# sourceMappingURL=bundle.js.map
|
||||
//# sourceMappingURL=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"}
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue