Skip to content

Commit d8a51cf

Browse files
committed
test: move --enable-source-maps test to a single file
1 parent f5c4c40 commit d8a51cf

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

test/parallel/test-runner-coverage.js

-37
Original file line numberDiff line numberDiff line change
@@ -321,43 +321,6 @@ test('coverage with source maps', skipIfNoInspector, () => {
321321
assert.strictEqual(result.status, 1);
322322
});
323323

324-
325-
test('coverage with --enable-source-maps option', skipIfNoInspector, () => {
326-
const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js');
327-
const args = [
328-
'--test', '--experimental-test-coverage', '--enable-source-maps', '--test-reporter', 'tap',
329-
fixture,
330-
];
331-
332-
let report = [
333-
'# start of coverage report',
334-
'# ------------------------------------------------------------------',
335-
'# file | line % | branch % | funcs % | uncovered lines',
336-
'# ------------------------------------------------------------------',
337-
'# test | | | | ',
338-
'# fixtures | | | | ',
339-
'# test-runner | | | | ',
340-
'# coverage | | | | ',
341-
'# stdin.test.ts | 57.14 | 100.00 | 100.00 | 4-6',
342-
'# ------------------------------------------------------------------',
343-
'# all files | 57.14 | 100.00 | 100.00 | ',
344-
'# ------------------------------------------------------------------',
345-
'# end of coverage report',
346-
].join('\n');
347-
348-
if (common.isWindows) {
349-
report = report.replaceAll('/', '\\');
350-
}
351-
352-
const result = spawnSync(process.execPath, args);
353-
const stdOut = result.stdout.toString();
354-
355-
assert.strictEqual(result.stderr.toString(), '');
356-
assert(!stdOut.includes('TypeError'));
357-
assert(stdOut.includes(report));
358-
assert.strictEqual(result.status, 0);
359-
});
360-
361324
test('coverage with source maps missing sources', skipIfNoInspector, () => {
362325
const file = fixtures.path('test-runner', 'source-map-missing-sources', 'index.js');
363326
const missing = fixtures.path('test-runner', 'source-map-missing-sources', 'nonexistent.js');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('node:assert');
4+
const { spawnSync } = require('node:child_process');
5+
const { test } = require('node:test');
6+
const fixtures = require('../common/fixtures');
7+
8+
test('ensures --enable-source-maps does not throw an error', () => {
9+
const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js');
10+
const args = ['--enable-source-maps', fixture];
11+
12+
const result = spawnSync(process.execPath, args);
13+
14+
assert.strictEqual(result.stderr.toString(), '');
15+
assert.strictEqual(result.status, 0);
16+
});

0 commit comments

Comments
 (0)