-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
feat: add support for v8 code coverage #8596
Merged
+436
−51
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
86fd625
feat: add support for v8 code coverage
SimenB df460c7
merge all v8 coverage before transforming to istanbul data
SimenB 14f8b2c
update
SimenB 66a1e7f
fix type errors
SimenB 587bea3
copyright headers
SimenB 4cbe3e5
update test
SimenB 839bfab
add some tests
SimenB 00436c9
docs
SimenB c80ef46
skip test on old nodes
SimenB eec6fa2
clarify caveats
SimenB b5ff1ab
[wip] use coverageProvider option instead
SimenB aaec90d
docs
SimenB 4cc2232
try to keep coverage within rootDir
SimenB 718a1a1
inline snapshot so skipping tests work
SimenB af4482b
update showconfig snap
SimenB 70ee018
maybe this?
SimenB c190ae6
equal and ignore in watcher
SimenB 6bade4a
get only files we have transformed from the runtime
SimenB 98b4f49
lint
SimenB cf34642
remove old doc change
SimenB c994954
combine filters
SimenB c2ff7d8
bump v8-to-istanbul
SimenB c5c1de6
add note about newer nodes
SimenB 78ceba8
extract v8 profile code
SimenB 881fd82
Apply suggestions from code review
SimenB 9c7c353
link to tracking issue
SimenB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import * as path from 'path'; | ||
import {onNodeVersions} from '@jest/test-utils'; | ||
import runJest from '../runJest'; | ||
|
||
const DIR = path.resolve(__dirname, '../v8-coverage'); | ||
|
||
onNodeVersions('>=10', () => { | ||
test('prints coverage', () => { | ||
const sourcemapDir = path.join(DIR, 'no-sourcemap'); | ||
const {stdout, exitCode} = runJest( | ||
sourcemapDir, | ||
['--coverage', '--coverage-provider', 'v8'], | ||
{ | ||
stripAnsi: true, | ||
}, | ||
); | ||
|
||
expect(exitCode).toBe(0); | ||
expect( | ||
'\n' + | ||
stdout | ||
.split('\n') | ||
.map(s => s.trimRight()) | ||
.join('\n') + | ||
'\n', | ||
).toEqual(` | ||
console.log __tests__/Thing.test.js:10 | ||
42 | ||
----------|---------|----------|---------|---------|------------------- | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ||
----------|---------|----------|---------|---------|------------------- | ||
All files | 100 | 100 | 100 | 100 | | ||
Thing.js | 100 | 100 | 100 | 100 | | ||
x.css | 100 | 100 | 100 | 100 | | ||
----------|---------|----------|---------|---------|------------------- | ||
`); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
require('./x.css'); | ||
|
||
module.exports = 42; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const Thing = require('../Thing'); | ||
|
||
console.log(Thing); | ||
test.todo('whatever'); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = { | ||
getCacheKey: () => 'cssTransform', | ||
process: () => 'module.exports = {};', | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "no-sourcemap", | ||
"version": "1.0.0", | ||
"jest": { | ||
"testEnvironment": "node", | ||
"transform": { | ||
"^.+\\.[jt]sx?$": "babel-jest", | ||
"^.+\\.css$": "<rootDir>/cssTransform.js" | ||
} | ||
} | ||
} |
Empty file.
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could move this to "Istanbul/merge-v8-coverage" or "merge-v8-coverage", @demurgos do you have a preference? Would you like to work on this library within the Istanbul organization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
As discussed in the
v8-coverage
repo, I am working on a 1.0.0 release of the lib. I agree that it would make sense to move it the istanbul org.