@@ -321,6 +321,39 @@ test('coverage with source maps', skipIfNoInspector, () => {
321321 assert . strictEqual ( result . status , 1 ) ;
322322} ) ;
323323
324+
325+ test . only ( '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+
324357test ( '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