Skip to content

Commit

Permalink
chore: removed fixture and tests for unsupported versions of c8 < 10
Browse files Browse the repository at this point in the history
This was breaking the lib/report.js since it now relies on either `fs/promises` or `fs.promises` depending on the version of Node.js.
  • Loading branch information
bizob2828 committed May 23, 2023
1 parent 0978bdf commit 028120e
Show file tree
Hide file tree
Showing 7 changed files with 1,946 additions and 95 deletions.
3 changes: 1 addition & 2 deletions lib/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Report {
* @param {Set} fileIndex list of files that have coverage
* @returns {Array} list of empty coverage reports
*/
_includeUncoveredFiles(fileIndex) {
_includeUncoveredFiles (fileIndex) {
const emptyReports = []
const workingDirs = this.src
const { extension } = this.exclude
Expand Down Expand Up @@ -325,7 +325,6 @@ class Report {
return reports
}


/**
* Normalizes a process coverage.
*
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/disable-fs-promises.js

This file was deleted.

22 changes: 10 additions & 12 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ beforeEach(function () {
'--temp-directory=tmp/check-coverage',
'--clean=false',
`--merge-async=${mergeAsync}`,
nodePath,
require.resolve('./fixtures/normal')
nodePath,
require.resolve('./fixtures/normal')
])
})

Expand All @@ -177,7 +177,7 @@ beforeEach(function () {
'--lines=70',
'--branches=55',
'--statements=70',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
status.should.equal(0)
output.toString('utf8').should.matchSnapshot()
Expand All @@ -190,7 +190,7 @@ beforeEach(function () {
'--exclude="test/*.js"',
'--temp-directory=tmp/check-coverage',
'--lines=101',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
status.should.equal(1)
output.toString('utf8').should.matchSnapshot()
Expand All @@ -204,7 +204,7 @@ beforeEach(function () {
'--temp-directory=tmp/check-coverage',
'--lines=101',
'--per-file',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
status.should.equal(1)
output.toString('utf8').should.matchSnapshot()
Expand Down Expand Up @@ -248,7 +248,7 @@ beforeEach(function () {
'--exclude="test/*.js"',
'--temp-directory=tmp/check-coverage',
'--100',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
status.should.equal(1)
output.toString('utf8').should.matchSnapshot()
Expand All @@ -275,7 +275,7 @@ beforeEach(function () {
'--exclude="test/*.js"',
'--temp-directory=./tmp/report',
'--clean=false',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
output.toString('utf8').should.matchSnapshot()
})
Expand All @@ -289,7 +289,7 @@ beforeEach(function () {
'--exclude="test/*.js"',
'--temp-directory=tmp/report',
'--clean=false',
`--merge-async=${mergeAsync}`,
`--merge-async=${mergeAsync}`
])
status.should.equal(1)
output.toString('utf8').should.matchSnapshot()
Expand All @@ -299,7 +299,7 @@ beforeEach(function () {
describe('ESM Modules', () => {
it('collects coverage for ESM modules', () => {
if (nodeMajorVersion === 10) return
const args = [
const { output } = spawnSync(nodePath, [
c8Path,
'--exclude="test/*.js"',
'--clean=false',
Expand All @@ -309,9 +309,7 @@ beforeEach(function () {
'--experimental-modules',
'--no-warnings',
require.resolve('./fixtures/import.mjs')
]
console.log(args)
const { output } = spawnSync(nodePath, args)
])
output.toString('utf8').should.matchSnapshot()
})
})
Expand Down
20 changes: 9 additions & 11 deletions test/integration.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ hey
---------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------------------|---------|----------|---------|---------|-------------------
All files | 1.82 | 12 | 6.25 | 1.82 |
All files | 1.82 | 12.24 | 6.38 | 1.82 |
c8 | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 1
c8/bin | 0 | 0 | 0 | 0 |
Expand All @@ -168,19 +168,18 @@ All files | 1.82 | 12 | 6.25 | 1.82
c8/lib | 0 | 0 | 0 | 0 |
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
parse-args.js | 0 | 0 | 0 | 0 | 1-224
report.js | 0 | 0 | 0 | 0 | 1-408
report.js | 0 | 0 | 0 | 0 | 1-407
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
c8/lib/commands | 0 | 0 | 0 | 0 |
check-coverage.js | 0 | 0 | 0 | 0 | 1-70
report.js | 0 | 0 | 0 | 0 | 1-42
c8/test/fixtures | 15.95 | 35.29 | 20 | 15.95 |
c8/test/fixtures | 16.3 | 37.5 | 21.42 | 16.3 |
async.js | 100 | 100 | 100 | 100 |
c8-ignore-next.js | 0 | 0 | 0 | 0 | 1-22
c8-ignore-start-stop.js | 0 | 0 | 0 | 0 | 1-21
computed-method.js | 0 | 0 | 0 | 0 | 1-15
custom-ext.special | 75 | 66.66 | 33.33 | 75 | 14-16,18-20
custom-ext2.special | 0 | 0 | 0 | 0 | 1-24
disable-fs-promises.js | 0 | 0 | 0 | 0 | 1-4
issue-254.js | 0 | 0 | 0 | 0 | 1-7
multiple-spawn.js | 0 | 0 | 0 | 0 | 1-12
normal.js | 0 | 0 | 0 | 0 | 1-24
Expand Down Expand Up @@ -523,7 +522,7 @@ hey
---------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------------------|---------|----------|---------|---------|-------------------
All files | 1.82 | 12 | 6.25 | 1.82 |
All files | 1.82 | 12.24 | 6.38 | 1.82 |
c8 | 0 | 0 | 0 | 0 |
index.js | 0 | 0 | 0 | 0 | 1
c8/bin | 0 | 0 | 0 | 0 |
Expand All @@ -535,19 +534,18 @@ All files | 1.82 | 12 | 6.25 | 1.82
c8/lib | 0 | 0 | 0 | 0 |
is-cjs-esm-bridge.js | 0 | 0 | 0 | 0 | 1-10
parse-args.js | 0 | 0 | 0 | 0 | 1-224
report.js | 0 | 0 | 0 | 0 | 1-408
report.js | 0 | 0 | 0 | 0 | 1-407
source-map-from-file.js | 0 | 0 | 0 | 0 | 1-100
c8/lib/commands | 0 | 0 | 0 | 0 |
check-coverage.js | 0 | 0 | 0 | 0 | 1-70
report.js | 0 | 0 | 0 | 0 | 1-42
c8/test/fixtures | 15.95 | 35.29 | 20 | 15.95 |
c8/test/fixtures | 16.3 | 37.5 | 21.42 | 16.3 |
async.js | 100 | 100 | 100 | 100 |
c8-ignore-next.js | 0 | 0 | 0 | 0 | 1-22
c8-ignore-start-stop.js | 0 | 0 | 0 | 0 | 1-21
computed-method.js | 0 | 0 | 0 | 0 | 1-15
custom-ext.special | 75 | 66.66 | 33.33 | 75 | 14-16,18-20
custom-ext2.special | 0 | 0 | 0 | 0 | 1-24
disable-fs-promises.js | 0 | 0 | 0 | 0 | 1-4
issue-254.js | 0 | 0 | 0 | 0 | 1-7
multiple-spawn.js | 0 | 0 | 0 | 0 | 1-12
normal.js | 0 | 0 | 0 | 0 | 1-24
Expand Down Expand Up @@ -999,13 +997,13 @@ hey
--------------------------|---------|----------|---------|---------|--------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------|---------|----------|---------|---------|--------------------------------
All files | 71.54 | 54.66 | 61.11 | 71.54 |
All files | 71.51 | 54.66 | 61.11 | 71.51 |
bin | 78.84 | 42.85 | 100 | 78.84 |
c8.js | 78.84 | 42.85 | 100 | 78.84 | 22,27-29,32-33,41-43,50-51
lib | 74.93 | 52.72 | 70.83 | 74.93 |
lib | 74.89 | 52.72 | 70.83 | 74.89 |
is-cjs-esm-bridge.js | 90 | 25 | 100 | 90 | 9
parse-args.js | 97.32 | 63.63 | 100 | 97.32 | 165-166,187-188,201-202
report.js | 69.6 | 54.28 | 78.57 | 69.6 | ...323,358-360,381-386,397-398
report.js | 69.53 | 54.28 | 78.57 | 69.53 | ...323,357-359,380-385,396-397
source-map-from-file.js | 45 | 100 | 0 | 45 | 39-50,52-67,69-77,81-98
lib/commands | 41.96 | 50 | 16.66 | 41.96 |
check-coverage.js | 18.57 | 100 | 0 | 18.57 | 9-11,14-36,39-53,55-70
Expand Down
Loading

0 comments on commit 028120e

Please sign in to comment.