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 <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
  • 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.