summaryrefslogtreecommitdiff
path: root/test/parallel/test-source-map.js
diff options
context:
space:
mode:
authorNolik <nolikfriendly@gmail.com>2019-11-06 18:43:53 +0300
committerRich Trott <rtrott@gmail.com>2019-11-09 05:53:55 -0800
commiteb773217ae6f4b4ea0e906ff1cc492502c32a006 (patch)
tree6b8c99601e8f1e5e70d982936bcb128ebc07769c /test/parallel/test-source-map.js
parentbbfa2e9cb13334032ad8704db7e5cdc6c457305c (diff)
downloadandroid-node-v8-eb773217ae6f4b4ea0e906ff1cc492502c32a006.tar.gz
android-node-v8-eb773217ae6f4b4ea0e906ff1cc492502c32a006.tar.bz2
android-node-v8-eb773217ae6f4b4ea0e906ff1cc492502c32a006.zip
process: add coverage tests for sourceMapFromDataUrl method
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test/parallel/test-source-map.js')
-rw-r--r--test/parallel/test-source-map.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/parallel/test-source-map.js b/test/parallel/test-source-map.js
index 2ded13a631..13fa391aaf 100644
--- a/test/parallel/test-source-map.js
+++ b/test/parallel/test-source-map.js
@@ -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.
{