Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update foreground-child version #503

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions bin/c8.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
'use strict'

const foreground = require('foreground-child')
const { foregroundChild } = require('foreground-child')
const { outputReport } = require('../lib/commands/report')
const { promises } = require('fs')
const { promisify } = require('util')
Expand All @@ -24,7 +24,7 @@ async function run () {
// fs.promises was not added until Node.js v10.0.0, if it doesn't
// exist, assume we're Node.js v8.x and skip coverage.
if (!promises) {
foreground(hideInstrumenterArgs(argv))
foregroundChild(hideInstrumenterArgs(argv))
return
}

Expand All @@ -34,19 +34,18 @@ async function run () {

await promises.mkdir(argv.tempDirectory, { recursive: true })
process.env.NODE_V8_COVERAGE = argv.tempDirectory
foreground(hideInstrumenterArgs(argv), async (done) => {
foregroundChild(hideInstrumenterArgs(argv), async () => {
try {
await outputReport(argv)
} catch (err) {
console.error(err.stack)
process.exitCode = 1
process.exit(1)
}
done()
})
}
}

run().catch((err) => {
console.error(err.stack)
process.exitCode = 1
process.exit(1)
})
2 changes: 1 addition & 1 deletion lib/commands/check-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function checkCoverage (summary, thresholds, file) {
Object.keys(thresholds).forEach(key => {
const coverage = summary[key].pct
if (coverage < thresholds[key]) {
process.exitCode = 1
if (file) {
console.error(
'ERROR: Coverage for ' + key + ' (' + coverage + '%) does not meet threshold (' + thresholds[key] + '%) for ' +
Expand All @@ -65,6 +64,7 @@ function checkCoverage (summary, thresholds, file) {
} else {
console.error('ERROR: Coverage for ' + key + ' (' + coverage + '%) does not meet global threshold (' + thresholds[key] + '%)')
}
process.exit(1)
}
})
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@bcoe/v8-coverage": "^0.2.3",
"@istanbuljs/schema": "^0.1.3",
"find-up": "^5.0.0",
"foreground-child": "^2.0.0",
"foreground-child": "3.1.1",
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-report": "^3.0.1",
"istanbul-reports": "^3.1.6",
Expand Down
Loading