diff --git a/test/parallel/test-runner-coverage.js b/test/parallel/test-runner-coverage.js index cbee25ff81deaef..77e0afadbdff955 100644 --- a/test/parallel/test-runner-coverage.js +++ b/test/parallel/test-runner-coverage.js @@ -321,43 +321,6 @@ test('coverage with source maps', skipIfNoInspector, () => { assert.strictEqual(result.status, 1); }); - -test('coverage with --enable-source-maps option', skipIfNoInspector, () => { - const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js'); - const args = [ - '--test', '--experimental-test-coverage', '--enable-source-maps', '--test-reporter', 'tap', - fixture, - ]; - - let report = [ - '# start of coverage report', - '# ------------------------------------------------------------------', - '# file | line % | branch % | funcs % | uncovered lines', - '# ------------------------------------------------------------------', - '# test | | | | ', - '# fixtures | | | | ', - '# test-runner | | | | ', - '# coverage | | | | ', - '# stdin.test.ts | 57.14 | 100.00 | 100.00 | 4-6', - '# ------------------------------------------------------------------', - '# all files | 57.14 | 100.00 | 100.00 | ', - '# ------------------------------------------------------------------', - '# end of coverage report', - ].join('\n'); - - if (common.isWindows) { - report = report.replaceAll('/', '\\'); - } - - const result = spawnSync(process.execPath, args); - const stdOut = result.stdout.toString(); - - assert.strictEqual(result.stderr.toString(), ''); - assert(!stdOut.includes('TypeError')); - assert(stdOut.includes(report)); - assert.strictEqual(result.status, 0); -}); - test('coverage with source maps missing sources', skipIfNoInspector, () => { const file = fixtures.path('test-runner', 'source-map-missing-sources', 'index.js'); const missing = fixtures.path('test-runner', 'source-map-missing-sources', 'nonexistent.js'); diff --git a/test/parallel/test-runner-enable-source-maps-issue.js b/test/parallel/test-runner-enable-source-maps-issue.js new file mode 100644 index 000000000000000..a09fbe02216fc35 --- /dev/null +++ b/test/parallel/test-runner-enable-source-maps-issue.js @@ -0,0 +1,19 @@ +'use strict'; +require('../common'); +const assert = require('node:assert'); +const { spawnSync } = require('node:child_process'); +const { test } = require('node:test'); +const fixtures = require('../common/fixtures'); +const skipIfNoInspector = { + skip: !process.features.inspector ? 'inspector disabled' : false +}; + +test('ensures --enable-source-maps does not throw an error', skipIfNoInspector, () => { + const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js'); + const args = ['--enable-source-maps', fixture]; + + const result = spawnSync(process.execPath, args); + + assert.strictEqual(result.stderr.toString(), ''); + assert.strictEqual(result.status, 0); +});