Skip to content

Commit

Permalink
process: add coverage tests for sourceMapFromDataUrl method
Browse files Browse the repository at this point in the history
PR-URL: #30319
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Coe <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Masashi Hirano <[email protected]>
  • Loading branch information
Nolik authored and MylesBorins committed Nov 17, 2019
1 parent 0f8662d commit e363f8e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/fixtures/source-map/inline-base64-json-error.js

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

2 changes: 2 additions & 0 deletions test/fixtures/source-map/inline-base64-type-error.js

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

32 changes: 32 additions & 0 deletions test/parallel/test-source-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,38 @@ function nextdir() {
);
}

// base64 encoding error does not crash application.
{
const coverageDirectory = nextdir();
const output = spawnSync(process.execPath, [
require.resolve('../fixtures/source-map/inline-base64-type-error.js')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);
assert.strictEqual(output.stderr.toString(), '');
const sourceMap = getSourceMapFromCache(
'inline-base64-type-error.js',
coverageDirectory
);

assert.strictEqual(sourceMap.data, null);
}

// JSON error does not crash application.
{
const coverageDirectory = nextdir();
const output = spawnSync(process.execPath, [
require.resolve('../fixtures/source-map/inline-base64-json-error.js')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);
assert.strictEqual(output.stderr.toString(), '');
const sourceMap = getSourceMapFromCache(
'inline-base64-json-error.js',
coverageDirectory
);

assert.strictEqual(sourceMap.data, null);
}

// Does not apply source-map to stack trace if --experimental-modules
// is not set.
{
Expand Down

0 comments on commit e363f8e

Please sign in to comment.