@@ -321,6 +321,43 @@ 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+
324361test ( 'coverage with source maps missing sources' , skipIfNoInspector , ( ) => {
325362 const file = fixtures . path ( 'test-runner' , 'source-map-missing-sources' , 'index.js' ) ;
326363 const missing = fixtures . path ( 'test-runner' , 'source-map-missing-sources' , 'nonexistent.js' ) ;
0 commit comments