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 MylesBorins committed Dec 17, 2019
1 parent 21be4b1 commit 0a068db
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 0a068db

Please sign in to comment.