Skip to content

Commit 4a29562

Browse files
committed
test: test case when --enable-source-maps is provided
1 parent 38126ee commit 4a29562

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/parallel/test-runner-coverage.js

+33
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,39 @@ 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+
const 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+
const result = spawnSync(process.execPath, args);
349+
const stdOut = result.stdout.toString();
350+
351+
assert.strictEqual(result.stderr.toString(), '');
352+
assert(!stdOut.includes('TypeError'));
353+
assert(stdOut.includes(report));
354+
assert.strictEqual(result.status, 0);
355+
});
356+
324357
test('coverage with source maps missing sources', skipIfNoInspector, () => {
325358
const file = fixtures.path('test-runner', 'source-map-missing-sources', 'index.js');
326359
const missing = fixtures.path('test-runner', 'source-map-missing-sources', 'nonexistent.js');

0 commit comments

Comments
 (0)