Skip to content

Commit 176b447

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

File tree

2 files changed

+19
-37
lines changed

2 files changed

+19
-37
lines changed

test/parallel/test-runner-coverage.js

Lines changed: 0 additions & 37 deletions
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');
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
const skipIfNoInspector = {
8+
skip: !process.features.inspector ? 'inspector disabled' : false
9+
};
10+
11+
test('ensures --enable-source-maps does not throw an error', skipIfNoInspector, () => {
12+
const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js');
13+
const args = ['--enable-source-maps', fixture];
14+
15+
const result = spawnSync(process.execPath, args);
16+
17+
assert.strictEqual(result.stderr.toString(), '');
18+
assert.strictEqual(result.status, 0);
19+
});

0 commit comments

Comments
 (0)