| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2573,6 +2573,12 @@ disconnected socket. | |||
| 2573 | 2573 | ||
| 2574 | 2574 | A call was made and the UDP subsystem was not running. | |
| 2575 | 2575 | ||
| 2576 | + <a id="ERR_SOURCE_MAP_CORRUPT"></a> | ||
| 2577 | + | ||
| 2578 | + ### `ERR_SOURCE_MAP_CORRUPT` | ||
| 2579 | + | ||
| 2580 | + The source map could not be parsed because it does not exist, or is corrupt. | ||
| 2581 | + | ||
| 2576 | 2582 | <a id="ERR_SOURCE_MAP_MISSING_SOURCE"></a> | |
| 2577 | 2583 | ||
| 2578 | 2584 | ### `ERR_SOURCE_MAP_MISSING_SOURCE` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1711,6 +1711,7 @@ E('ERR_SOCKET_CONNECTION_TIMEOUT', | |||
| 1711 | 1711 | E('ERR_SOCKET_DGRAM_IS_CONNECTED', 'Already connected', Error); | |
| 1712 | 1712 | E('ERR_SOCKET_DGRAM_NOT_CONNECTED', 'Not connected', Error); | |
| 1713 | 1713 | E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error); | |
| 1714 | + E('ERR_SOURCE_MAP_CORRUPT', `The source map for '%s' does not exist or is corrupt.`, Error); | ||
| 1714 | 1715 | E('ERR_SOURCE_MAP_MISSING_SOURCE', `Cannot find '%s' imported from the source map for '%s'`, Error); | |
| 1715 | 1716 | E('ERR_SRI_PARSE', | |
| 1716 | 1717 | 'Subresource Integrity string %j had an unexpected %j at position %d', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,7 @@ const { fileURLToPath } = require('internal/url'); | |||
| 32 | 32 | const { kMappings, SourceMap } = require('internal/source_map/source_map'); | |
| 33 | 33 | const { | |
| 34 | 34 | codes: { | |
| 35 | + ERR_SOURCE_MAP_CORRUPT, | ||
| 35 | 36 | ERR_SOURCE_MAP_MISSING_SOURCE, | |
| 36 | 37 | }, | |
| 37 | 38 | } = require('internal/errors'); | |
@@ -353,6 +354,7 @@ class TestCoverage { | |||
| 353 | 354 | continue; | |
| 354 | 355 | } | |
| 355 | 356 | const { data, lineLengths } = sourceMapCache[url]; | |
| 357 | + if (!data) throw new ERR_SOURCE_MAP_CORRUPT(url); | ||
| 356 | 358 | let offset = 0; | |
| 357 | 359 | const executedLines = ArrayPrototypeMap(lineLengths, (length, i) => { | |
| 358 | 360 | const coverageLine = new CoverageLine(i + 1, offset, null, length + 1); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,4 +80,18 @@ describe('Coverage with source maps', async () => { | |||
| 80 | 80 | t.assert.ok(spawned.stdout.includes(error)); | |
| 81 | 81 | t.assert.strictEqual(spawned.code, 1); | |
| 82 | 82 | }); | |
| 83 | + | ||
| 84 | + for (const [file, message] of [ | ||
| 85 | + [fixtures.path('test-runner', 'source-maps', 'invalid-json', 'index.js'), 'is not valid JSON'], | ||
| 86 | + [fixtures.path('test-runner', 'source-maps', 'missing-map.js'), 'does not exist'], | ||
| 87 | + ]) { | ||
| 88 | + await it(`should throw when a source map ${message}`, async (t) => { | ||
| 89 | + const spawned = await common.spawnPromisified(process.execPath, [...flags, file]); | ||
| 90 | + | ||
| 91 | + const error = `The source map for '${pathToFileURL(file)}' does not exist or is corrupt`; | ||
| 92 | + t.assert.strictEqual(spawned.stderr, ''); | ||
| 93 | + t.assert.ok(spawned.stdout.includes(error)); | ||
| 94 | + t.assert.strictEqual(spawned.code, 1); | ||
| 95 | + }); | ||
| 96 | + } | ||
| 83 | 97 | }).then(common.mustCall()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments