Skip to content

Commit

Permalink
test: test cover cases when trace is empty
Browse files Browse the repository at this point in the history
cover prepare_stack_trace in case when trace is empty
PR-URL: #30311
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
telenord authored and targos committed Dec 1, 2019
1 parent 78b2d86 commit 99770a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/fixtures/source-map/emptyStackError.js
@@ -0,0 +1,6 @@
"use strict";

Error.stackTraceLimit = 0;
throw new RangeError('emptyStackError');


12 changes: 12 additions & 0 deletions test/parallel/test-source-map.js
Expand Up @@ -255,6 +255,18 @@ function nextdir() {
}
}

// trace.length === 0 .
{
const output = spawnSync(process.execPath, [
'--enable-source-maps',
require.resolve('../fixtures/source-map/emptyStackError.js')
]);

assert.ok(
output.stderr.toString().match('emptyStackError')
);
}

function getSourceMapFromCache(fixtureFile, coverageDirectory) {
const jsonFiles = fs.readdirSync(coverageDirectory);
for (const jsonFile of jsonFiles) {
Expand Down

0 comments on commit 99770a0

Please sign in to comment.