@@ -19,6 +19,7 @@ function generateReport(report) {
1919}
2020
2121const flags = [
22+ '--enable-source-maps' ,
2223 '--test' , '--experimental-test-coverage' , '--test-reporter' , 'tap' ,
2324] ;
2425
@@ -40,6 +41,28 @@ describe('Coverage with source maps', async () => {
4041 const spawned = await common . spawnPromisified ( process . execPath , flags , {
4142 cwd : fixtures . path ( 'test-runner' , 'coverage' )
4243 } ) ;
44+
45+ t . assert . strictEqual ( spawned . stderr , '' ) ;
46+ t . assert . ok ( spawned . stdout . includes ( report ) ) ;
47+ t . assert . strictEqual ( spawned . code , 1 ) ;
48+ } ) ;
49+
50+ await it ( 'should only work with --enable-source-maps' , async ( t ) => {
51+ const report = generateReport ( [
52+ '# --------------------------------------------------------------' ,
53+ '# file | line % | branch % | funcs % | uncovered lines' ,
54+ '# --------------------------------------------------------------' ,
55+ '# a.test.mjs | 100.00 | 100.00 | 100.00 | ' ,
56+ '# index.test.js | 71.43 | 66.67 | 100.00 | 6-7' ,
57+ '# stdin.test.js | 100.00 | 100.00 | 100.00 | ' ,
58+ '# --------------------------------------------------------------' ,
59+ '# all files | 85.71 | 87.50 | 100.00 | ' ,
60+ '# --------------------------------------------------------------' ,
61+ ] ) ;
62+
63+ const spawned = await common . spawnPromisified ( process . execPath , flags . slice ( 1 ) , {
64+ cwd : fixtures . path ( 'test-runner' , 'coverage' )
65+ } ) ;
4366 t . assert . strictEqual ( spawned . stderr , '' ) ;
4467 t . assert . ok ( spawned . stdout . includes ( report ) ) ;
4568 t . assert . strictEqual ( spawned . code , 1 ) ;
0 commit comments