Skip to content

Commit

Permalink
test: fix up commented out tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Apr 10, 2024
1 parent f002a62 commit 2f8a2bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
14 changes: 7 additions & 7 deletions tap-snapshots/test/nyc-integration.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ exports[`test/nyc-integration.js > TAP > --ignore-class-method skips methods tha
---------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------------|---------|----------|---------|---------|-------------------
All files | 1.44 | 0 | 5 | 1.87 |
cli | 2.06 | 0 | 5.56 | 3.08 |
All files | 1.43 | 0 | 5 | 1.86 |
cli | 2.06 | 0 | 5.55 | 3.07 |
args.js | 0 | 100 | 100 | 0 | 1
by-arg2.js | 0 | 0 | 100 | 0 | 1-7
classes.js | 66.67 | 100 | 50 | 66.67 | 6
classes.js | 66.66 | 100 | 50 | 66.66 | 6
conf-override-module.js | 0 | 100 | 100 | 0 | 1-2
conf-override-root.js | 0 | 0 | 100 | 0 | 1-23
empty.js | 0 | 0 | 0 | 0 |
Expand Down Expand Up @@ -440,7 +440,7 @@ All files | 80 | 100 | 50 | 80 |

exports[`test/nyc-integration.js > TAP > can run "npm test" which directly invokes a test file > stdout 1`] = `
> @ test .
> test
> node ./half-covered.js
-----------------|---------|----------|---------|---------|-------------------
Expand All @@ -454,15 +454,15 @@ All files | 50 | 50 | 100 | 50 |

exports[`test/nyc-integration.js > TAP > can run "npm test" which indirectly invokes a test file > stdout 1`] = `
> @ test .
> test
> npm run test:deeper
> @ test:deeper .
> test:deeper
> npm run test:even-deeper
> @ test:even-deeper .
> test:even-deeper
> node ./half-covered.js
-----------------|---------|----------|---------|---------|-------------------
Expand Down
14 changes: 3 additions & 11 deletions test/nyc-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ t.test('report and check should show coverage check along with report', async t
})
})

/*
t.test('--ignore-class-method skips methods that match ignored name but still catches those that are not', t => testSuccess(t, {
args: ['--all', '--ignore-class-method', 'skip', process.execPath, './classes.js']
}))
*/

t.test('--check-coverage fails when the expected coverage is below a threshold', t => testFailure(t, {
args: ['--check-coverage', '--lines', '51', process.execPath, './half-covered.js']
Expand Down Expand Up @@ -207,19 +205,15 @@ t.test('--use-spawn-wrap=false is functional', t => testSuccess(t, {
args: ['--use-spawn-wrap=false', process.execPath, 'selfspawn-fibonacci.js', '5']
}))

/*
t.test('can run "npm test" which directly invokes a test file', t => testSuccess(t, {
args: ['npm', 'test'],
cwd: path.resolve(fixturesCLI, 'run-npm-test')
}))
*/

/*
t.test('can run "npm test" which indirectly invokes a test file', t => testSuccess(t, {
args: ['npm', 'test'],
cwd: path.resolve(fixturesCLI, 'run-npm-test-recursive')
}))
*/

t.test('nyc instrument single file to console', async t => {
const { status, stderr, originalText } = await runNYC({
Expand Down Expand Up @@ -602,7 +596,6 @@ t.test('recursive run does not throw', t => testSuccess(t, {
cwd: path.resolve(__dirname, 'fixtures/recursive-run')
}))

/*
t.test('combines multiple coverage reports', async t => {
await testSuccess(t, {
args: ['merge', './merge-input']
Expand All @@ -611,21 +604,20 @@ t.test('combines multiple coverage reports', async t => {
const mergedCoverage = require('./fixtures/cli/coverage')
// the combined reports should have 100% function
// branch and statement coverage.
t.strictDeepEqual(
t.same(
mergedCoverage['/private/tmp/contrived/library.js'].s,
{ 0: 2, 1: 1, 2: 1, 3: 2, 4: 1, 5: 1 }
)
t.strictDeepEqual(
t.same(
mergedCoverage['/private/tmp/contrived/library.js'].f,
{ 0: 1, 1: 1, 2: 2 }
)
t.strictDeepEqual(
t.same(
mergedCoverage['/private/tmp/contrived/library.js'].b,
{ 0: [1, 1] }
)
await rimraf(path.resolve(fixturesCLI, 'coverage.json'))
})
*/

t.test('reports error if input directory is missing', t => testFailure(t, {
args: ['merge', './DIRECTORY_THAT_IS_MISSING']
Expand Down

0 comments on commit 2f8a2bb

Please sign in to comment.