test: test cover cases when trace is empty

cover prepare_stack_trace in case when trace is empty
PR-URL: https://github.com/nodejs/node/pull/30311
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
pull/30622/head
telenord 2019-11-06 17:32:13 +03:00 committed by Gireesh Punathil
parent 5de2afb94e
commit d90219d9ad
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,6 @@
"use strict";
Error.stackTraceLimit = 0;
throw new RangeError('emptyStackError');

View File

@ -253,6 +253,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) {