Skip to content

Commit

Permalink
fix: disable code coverage on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Nov 2, 2023
1 parent 57e5e0b commit 7287099
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 4 additions & 2 deletions src/cmds/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os from 'os'
import kleur from 'kleur'
import { loadUserConfig } from '../config/user.js'
import testCmd from '../test/index.js'
Expand Down Expand Up @@ -112,9 +113,10 @@ export default {
* @param {any} argv
*/
async handler (argv) {
// temporarily disable code coverage on node 18
if (argv.cov && process.version.startsWith('v18.')) {
// temporarily disable code coverage on Windows
if (argv.cov && os.platform() === 'win32') {
console.warn(kleur.red('!!! Temporarily disabling code coverage\n')) // eslint-disable-line no-console
console.warn(kleur.red('!!! See https://github.com/ipfs/aegir/issues/1206 for more information')) // eslint-disable-line no-console
delete argv.cov
}

Expand Down
15 changes: 3 additions & 12 deletions src/test/node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os from 'os'
import path from 'path'
import { fileURLToPath } from 'url'
import { execa } from 'execa'
Expand Down Expand Up @@ -117,17 +116,9 @@ export default async function testNode (argv, execaOptions) {
console.warn(kleur.red('!!! See https://github.com/ipfs/aegir/issues/1206 for more information')) // eslint-disable-line no-console
killedWhileCollectingCoverage = true

if (os.platform() === 'win32') {
// SIGTERM/SIGKILL doesn't work reliably on windows
execa('taskkill', ['/F', '/pid', `${proc.pid}`])
.catch(err => {
console.error('Could not kill process with PID', proc.pid, err) // eslint-disable-line no-console
})
} else {
proc.kill('SIGTERM', {
forceKillAfterTimeout: 1000
})
}
proc.kill('SIGTERM', {
forceKillAfterTimeout: 1000
})
}, argv.covTimeout).unref()
}
})
Expand Down

0 comments on commit 7287099

Please sign in to comment.