| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,7 +109,11 @@ class ModuleJob { | |||
| 109 | 109 | if (StringPrototypeIncludes(e.message, | |
| 110 | 110 | ' does not provide an export named')) { | |
| 111 | 111 | const splitStack = StringPrototypeSplit(e.stack, '\n'); | |
| 112 | - const parentFileUrl = splitStack[0]; | ||
| 112 | + const parentFileUrl = StringPrototypeReplace( | ||
| 113 | + splitStack[0], | ||
| 114 | + /:\d+$/, | ||
| 115 | + '' | ||
| 116 | + ); | ||
| 113 | 117 | const { 1: childSpecifier, 2: name } = StringPrototypeMatch( | |
| 114 | 118 | e.message, | |
| 115 | 119 | /module '(.*)' does not provide an export named '(.+)'/); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + import {doesNotExist} from './dep.js'; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + { | ||
| 2 | + "resources": { | ||
| 3 | + "../bad-main.mjs": { | ||
| 4 | + "integrity": true, | ||
| 5 | + "dependencies": true | ||
| 6 | + }, | ||
| 7 | + "../dep.js": { | ||
| 8 | + "integrity": true | ||
| 9 | + } | ||
| 10 | + } | ||
| 11 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,3 +89,23 @@ const dep = fixtures.path('policy', 'parent.js'); | |||
| 89 | 89 | ); | |
| 90 | 90 | assert.strictEqual(status, 1); | |
| 91 | 91 | } | |
| 92 | + { | ||
| 93 | + // Regression test for https://github.com/nodejs/node/issues/37812 | ||
| 94 | + const depPolicy = fixtures.path( | ||
| 95 | + 'policy', | ||
| 96 | + 'dependencies', | ||
| 97 | + 'dependencies-missing-export-policy.json'); | ||
| 98 | + const { status, stderr } = spawnSync( | ||
| 99 | + process.execPath, | ||
| 100 | + [ | ||
| 101 | + '--experimental-policy', | ||
| 102 | + depPolicy, | ||
| 103 | + fixtures.path('policy', 'bad-main.mjs'), | ||
| 104 | + ] | ||
| 105 | + ); | ||
| 106 | + assert.strictEqual(status, 1); | ||
| 107 | + assert.match( | ||
| 108 | + `${stderr}`, | ||
| 109 | + /SyntaxError: Named export 'doesNotExist' not found\./, | ||
| 110 | + 'Should give the real SyntaxError and position'); | ||
| 111 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments