| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 744e40e commit 6fcd3cf
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -235,13 +235,30 @@ function replaceJunitDuration(str) { | |||
| 235 | 235 | // This transform picks only the first line and then the lines from the test | |
| 236 | 236 | // file. | |
| 237 | 237 | function pickTestFileFromLcov(str) { | |
| 238 | + const expectedFile = 'output.js'; | ||
| 238 | 239 | const lines = str.split(/\n/); | |
| 239 | 240 | const firstLineOfTestFile = lines.findIndex( | |
| 240 | - (line) => line.startsWith('SF:') && line.trim().endsWith('output.js'), | ||
| 241 | + (line) => line.startsWith('SF:') && line.trim().endsWith(expectedFile), | ||
| 241 | 242 | ); | |
| 243 | + | ||
| 244 | + if (firstLineOfTestFile === -1) { | ||
| 245 | + assert.fail( | ||
| 246 | + `Could not find LCOV source record ending with ${expectedFile} ` + | ||
| 247 | + `in LCOV output:\n${str || '<empty>'}`, | ||
| 248 | + ); | ||
| 249 | + } | ||
| 250 | + | ||
| 242 | 251 | const lastLineOfTestFile = lines.findIndex( | |
| 243 | 252 | (line, index) => index > firstLineOfTestFile && line.trim() === 'end_of_record', | |
| 244 | 253 | ); | |
| 254 | + | ||
| 255 | + if (lastLineOfTestFile === -1) { | ||
| 256 | + assert.fail( | ||
| 257 | + `Could not find end_of_record for LCOV source record ending with ${expectedFile} ` + | ||
| 258 | + `in LCOV output:\n${str}`, | ||
| 259 | + ); | ||
| 260 | + } | ||
| 261 | + | ||
| 245 | 262 | return ( | |
| 246 | 263 | lines[0] + '\n' + lines.slice(firstLineOfTestFile, lastLineOfTestFile + 1).join('\n') + '\n' | |
| 247 | 264 | ); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ require('../../../common'); | |||
| 3 | 3 | const fixtures = require('../../../common/fixtures'); | |
| 4 | 4 | const spawn = require('node:child_process').spawn; | |
| 5 | 5 | ||
| 6 | - spawn( | ||
| 6 | + const child = spawn( | ||
| 7 | 7 | process.execPath, | |
| 8 | 8 | [ | |
| 9 | 9 | '--no-warnings', | |
@@ -14,3 +14,16 @@ spawn( | |||
| 14 | 14 | ], | |
| 15 | 15 | { stdio: 'inherit' }, | |
| 16 | 16 | ); | |
| 17 | + | ||
| 18 | + child.on('error', (err) => { | ||
| 19 | + throw err; | ||
| 20 | + }); | ||
| 21 | + | ||
| 22 | + child.on('exit', (code, signal) => { | ||
| 23 | + if (signal) { | ||
| 24 | + process.kill(process.pid, signal); | ||
| 25 | + return; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + process.exitCode = code ?? 1; | ||
| 29 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments