c8 8.0.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/c8.js +7 -16
  2. package/package.json +5 -6
package/bin/c8.js CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict'
3
3
 
4
- const foreground = require('foreground-child')
4
+ const { foregroundChild } = require('foreground-child')
5
5
  const { outputReport } = require('../lib/commands/report')
6
- const { promises } = require('fs')
7
- const { promisify } = require('util')
8
- const rimraf = require('rimraf')
6
+ const { rm, mkdir } = require('fs/promises')
9
7
  const {
10
8
  buildYargs,
11
9
  hideInstrumenteeArgs,
@@ -21,27 +19,20 @@ async function run () {
21
19
  ].indexOf(argv._[0]) !== -1) {
22
20
  argv = buildYargs(true).parse(process.argv.slice(2))
23
21
  } else {
24
- // fs.promises was not added until Node.js v10.0.0, if it doesn't
25
- // exist, assume we're Node.js v8.x and skip coverage.
26
- if (!promises) {
27
- foreground(hideInstrumenterArgs(argv))
28
- return
29
- }
30
-
31
22
  if (argv.clean) {
32
- await promisify(rimraf)(argv.tempDirectory)
23
+ await rm(argv.tempDirectory, { recursive: true, force: true })
33
24
  }
34
25
 
35
- await promises.mkdir(argv.tempDirectory, { recursive: true })
26
+ await mkdir(argv.tempDirectory, { recursive: true })
36
27
  process.env.NODE_V8_COVERAGE = argv.tempDirectory
37
- foreground(hideInstrumenterArgs(argv), async (done) => {
28
+ foregroundChild(hideInstrumenterArgs(argv), async () => {
38
29
  try {
39
30
  await outputReport(argv)
31
+ return process.exitCode
40
32
  } catch (err) {
41
33
  console.error(err.stack)
42
- process.exitCode = 1
34
+ return 1
43
35
  }
44
- done()
45
36
  })
46
37
  }
47
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8",
3
- "version": "8.0.1",
3
+ "version": "9.0.0",
4
4
  "description": "output coverage reports using Node.js' built in coverage",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -36,28 +36,27 @@
36
36
  "@bcoe/v8-coverage": "^0.2.3",
37
37
  "@istanbuljs/schema": "^0.1.3",
38
38
  "find-up": "^5.0.0",
39
- "foreground-child": "^2.0.0",
39
+ "foreground-child": "^3.1.1",
40
40
  "istanbul-lib-coverage": "^3.2.0",
41
41
  "istanbul-lib-report": "^3.0.1",
42
42
  "istanbul-reports": "^3.1.6",
43
- "rimraf": "^3.0.2",
44
43
  "test-exclude": "^6.0.0",
45
44
  "v8-to-istanbul": "^9.0.0",
46
45
  "yargs": "^17.7.2",
47
46
  "yargs-parser": "^21.1.1"
48
47
  },
49
48
  "devDependencies": {
50
- "@types/node": "^18.0.0",
49
+ "@types/node": "^20.0.0",
51
50
  "chai": "^4.3.6",
52
51
  "chai-jest-snapshot": "^2.0.0",
53
52
  "cross-env": "^7.0.3",
54
53
  "mocha": "^9.2.2",
55
54
  "standard": "^16.0.4",
56
55
  "ts-node": "^10.7.0",
57
- "typescript": "^4.6.2"
56
+ "typescript": "^5.0.0"
58
57
  },
59
58
  "engines": {
60
- "node": ">=12"
59
+ "node": ">=14.14.0"
61
60
  },
62
61
  "files": [
63
62
  "index.js",