@@ -6,7 +6,6 @@ const { readdirSync } = require('node:fs');
6
6
const { test } = require ( 'node:test' ) ;
7
7
const fixtures = require ( '../common/fixtures' ) ;
8
8
const tmpdir = require ( '../common/tmpdir' ) ;
9
- const { pathToFileURL } = require ( 'node:url' ) ;
10
9
const skipIfNoInspector = {
11
10
skip : ! process . features . inspector ? 'inspector disabled' : false
12
11
} ;
@@ -290,51 +289,6 @@ test('coverage reports on lines, functions, and branches', skipIfNoInspector, as
290
289
} ) ;
291
290
} ) ;
292
291
293
- test ( 'coverage with source maps' , skipIfNoInspector , ( ) => {
294
- let report = [
295
- '# start of coverage report' ,
296
- '# --------------------------------------------------------------' ,
297
- '# file | line % | branch % | funcs % | uncovered lines' ,
298
- '# --------------------------------------------------------------' ,
299
- '# a.test.ts | 53.85 | 100.00 | 100.00 | 8-13' , // part of a bundle
300
- '# b.test.ts | 55.56 | 100.00 | 100.00 | 1 7-9' , // part of a bundle
301
- '# index.test.js | 71.43 | 66.67 | 100.00 | 6-7' , // no source map
302
- '# stdin.test.ts | 57.14 | 100.00 | 100.00 | 4-6' , // Source map without original file
303
- '# --------------------------------------------------------------' ,
304
- '# all files | 58.33 | 87.50 | 100.00 | ' ,
305
- '# --------------------------------------------------------------' ,
306
- '# end of coverage report' ,
307
- ] . join ( '\n' ) ;
308
-
309
- if ( common . isWindows ) {
310
- report = report . replaceAll ( '/' , '\\' ) ;
311
- }
312
-
313
- const fixture = fixtures . path ( 'test-runner' , 'coverage' ) ;
314
- const args = [
315
- '--test' , '--experimental-test-coverage' , '--test-reporter' , 'tap' ,
316
- ] ;
317
- const result = spawnSync ( process . execPath , args , { cwd : fixture } ) ;
318
-
319
- assert . strictEqual ( result . stderr . toString ( ) , '' ) ;
320
- assert ( result . stdout . toString ( ) . includes ( report ) ) ;
321
- assert . strictEqual ( result . status , 1 ) ;
322
- } ) ;
323
-
324
- test ( 'coverage with source maps missing sources' , skipIfNoInspector , ( ) => {
325
- const file = fixtures . path ( 'test-runner' , 'source-map-missing-sources' , 'index.js' ) ;
326
- const missing = fixtures . path ( 'test-runner' , 'source-map-missing-sources' , 'nonexistent.js' ) ;
327
- const result = spawnSync ( process . execPath , [
328
- '--test' ,
329
- '--experimental-test-coverage' ,
330
- file ,
331
- ] ) ;
332
-
333
- const error = `Cannot find '${ pathToFileURL ( missing ) } ' imported from the source map for '${ pathToFileURL ( file ) } '` ;
334
- assert ( result . stdout . toString ( ) . includes ( error ) ) ;
335
- assert . strictEqual ( result . status , 1 ) ;
336
- } ) ;
337
-
338
292
test ( 'coverage with ESM hook - source irrelevant' , skipIfNoInspector , ( ) => {
339
293
let report = [
340
294
'# start of coverage report' ,
@@ -501,34 +455,6 @@ test('coverage with included and excluded files', skipIfNoInspector, () => {
501
455
assert ( ! findCoverageFileForPid ( result . pid ) ) ;
502
456
} ) ;
503
457
504
- test ( 'properly accounts for line endings in source maps' , skipIfNoInspector , ( ) => {
505
- const fixture = fixtures . path ( 'test-runner' , 'source-map-line-lengths' , 'index.js' ) ;
506
- const args = [
507
- '--test' , '--experimental-test-coverage' , '--test-reporter' , 'tap' ,
508
- fixture ,
509
- ] ;
510
- const report = [
511
- '# start of coverage report' ,
512
- '# ----------------------------------------------------------------------------' ,
513
- '# file | line % | branch % | funcs % | uncovered lines' ,
514
- '# ----------------------------------------------------------------------------' ,
515
- '# test | | | | ' ,
516
- '# fixtures | | | | ' ,
517
- '# test-runner | | | | ' ,
518
- '# source-map-line-lengths | | | | ' ,
519
- '# index.ts | 100.00 | 100.00 | 100.00 | ' ,
520
- '# ----------------------------------------------------------------------------' ,
521
- '# all files | 100.00 | 100.00 | 100.00 | ' ,
522
- '# ----------------------------------------------------------------------------' ,
523
- '# end of coverage report' ,
524
- ] . join ( '\n' ) ;
525
-
526
- const result = spawnSync ( process . execPath , args ) ;
527
- assert . strictEqual ( result . stderr . toString ( ) , '' ) ;
528
- assert ( result . stdout . toString ( ) . includes ( report ) ) ;
529
- assert . strictEqual ( result . status , 0 ) ;
530
- } ) ;
531
-
532
458
test ( 'correctly prints the coverage report of files contained in parent directories' , skipIfNoInspector , ( ) => {
533
459
let report = [
534
460
'# start of coverage report' ,
0 commit comments