-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: add support for v8 code coverage #8596
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
Changes from 10 commits
86fd625
df460c7
14f8b2c
66a1e7f
587bea3
4cbe3e5
839bfab
00436c9
c80ef46
eec6fa2
b5ff1ab
aaec90d
4cc2232
718a1a1
af4482b
70ee018
c190ae6
6bade4a
98b4f49
cf34642
c994954
c2ff7d8
c5c1de6
78ceba8
881fd82
9c7c353
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`prints coverage 1`] = ` | ||
| 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 | | ||
| ----------|---------|----------|---------|---------|------------------- | ||
| `; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * 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 {wrap} from 'jest-snapshot-serializer-raw'; | ||
| 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, ['--v8-coverage'], { | ||
| stripAnsi: true, | ||
| }); | ||
|
|
||
| expect(exitCode).toBe(0); | ||
| expect(wrap(stdout)).toMatchSnapshot(); | ||
| }); | ||
| }); |
| 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; |
| 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'); |
| 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 = {};', | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "name": "no-sourcemap", | ||
| "version": "1.0.0", | ||
| "jest": { | ||
| "collectCoverageFrom": ["Thing.js"], | ||
| "testEnvironment": "node", | ||
| "transform": { | ||
| "^.+\\.[jt]sx?$": "babel-jest", | ||
| "^.+\\.css$": "<rootDir>/cssTransform.js" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| **/__mocks__/** | ||
| **/__tests__/** | ||
| src |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "@jest/coverage", | ||
|
||
| "version": "24.9.0", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/facebook/jest.git", | ||
| "directory": "packages/jest-coverage" | ||
| }, | ||
| "license": "MIT", | ||
| "main": "build/index.js", | ||
| "types": "build/index.d.ts", | ||
| "devDependencies": { | ||
| "@types/node": "*" | ||
| }, | ||
| "engines": { | ||
| "node": ">= 8" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "gitHead": "0efb1d7809cb96ae87a7601e7802f1dab3774280" | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.