Skip to content

Commit 5a98f1c

Browse files
committed
test: move --enable-source-maps test to a single file
1 parent 025f1a9 commit 5a98f1c

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

test/parallel/test-runner-coverage.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -320,43 +320,6 @@ test('coverage with source maps', skipIfNoInspector, () => {
320320
assert.strictEqual(result.status, 1);
321321
});
322322

323-
324-
test('coverage with --enable-source-maps option', skipIfNoInspector, () => {
325-
const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js');
326-
const args = [
327-
'--test', '--experimental-test-coverage', '--enable-source-maps', '--test-reporter', 'tap',
328-
fixture,
329-
];
330-
331-
let report = [
332-
'# start of coverage report',
333-
'# ------------------------------------------------------------------',
334-
'# file | line % | branch % | funcs % | uncovered lines',
335-
'# ------------------------------------------------------------------',
336-
'# test | | | | ',
337-
'# fixtures | | | | ',
338-
'# test-runner | | | | ',
339-
'# coverage | | | | ',
340-
'# stdin.test.ts | 57.14 | 100.00 | 100.00 | 4-6',
341-
'# ------------------------------------------------------------------',
342-
'# all files | 57.14 | 100.00 | 100.00 | ',
343-
'# ------------------------------------------------------------------',
344-
'# end of coverage report',
345-
].join('\n');
346-
347-
if (common.isWindows) {
348-
report = report.replaceAll('/', '\\');
349-
}
350-
351-
const result = spawnSync(process.execPath, args);
352-
const stdOut = result.stdout.toString();
353-
354-
assert.strictEqual(result.stderr.toString(), '');
355-
assert(!stdOut.includes('TypeError'));
356-
assert(stdOut.includes(report));
357-
assert.strictEqual(result.status, 0);
358-
});
359-
360323
test('coverage with source maps missing sources', skipIfNoInspector, () => {
361324
const file = fixtures.path('test-runner', 'source-map-missing-sources', 'index.js');
362325
const missing = fixtures.path('test-runner', 'source-map-missing-sources', 'nonexistent.js');
Lines changed: 16 additions & 0 deletions
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)