-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: omit inaccessible files from coverage
If V8 generates code coverage for a file that is later inaccessible to the test runner, then omit that file from the coverage report. PR-URL: #47850 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
- Loading branch information
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
'use strict'; | ||
const assert = require('node:assert'); | ||
const { unlinkSync, writeFileSync } = require('node:fs') | ||
const { join } = require('node:path'); | ||
const { test } = require('node:test'); | ||
const common = require('./common'); | ||
|
||
test('third 1', () => { | ||
common.fnC(1, 4); | ||
common.fnD(99); | ||
}); | ||
|
||
assert(process.env.NODE_TEST_TMPDIR); | ||
const tmpFilePath = join(process.env.NODE_TEST_TMPDIR, 'temp-module.js'); | ||
writeFileSync(tmpFilePath, ` | ||
module.exports = { | ||
fn() { | ||
return 42; | ||
} | ||
}; | ||
`); | ||
const tempModule = require(tmpFilePath); | ||
assert.strictEqual(tempModule.fn(), 42); | ||
// Deleted files should not be part of the coverage report. | ||
unlinkSync(tmpFilePath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters