diff --git a/test/fixtures/source-map/emptyStackError.js b/test/fixtures/source-map/emptyStackError.js new file mode 100644 index 00000000000000..b02367a180dab7 --- /dev/null +++ b/test/fixtures/source-map/emptyStackError.js @@ -0,0 +1,6 @@ +"use strict"; + +Error.stackTraceLimit = 0; +throw new RangeError('emptyStackError'); + + diff --git a/test/parallel/test-source-map.js b/test/parallel/test-source-map.js index 2ded13a631dd8c..ae7aa5dbd49df0 100644 --- a/test/parallel/test-source-map.js +++ b/test/parallel/test-source-map.js @@ -223,6 +223,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) {