-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
istanbul
coverage provider (#1676)
Co-authored-by: Anthony Fu <[email protected]>
- Loading branch information
1 parent
1d15efa
commit 265fdbe
Showing
47 changed files
with
1,228 additions
and
285 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ node_modules | |
*.d.ts | ||
coverage | ||
!.vitepress | ||
test/core/src/self | ||
test/core/src/self |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ yarn-debug.log* | |
yarn-error.log* | ||
lib-cov | ||
coverage | ||
!**/integrations/coverage | ||
node_modules | ||
.env | ||
.cache | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@vitest/coverage-c8", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"description": "C8 coverage provider for Vitest", | ||
"author": "Anthony Fu <[email protected]>", | ||
"license": "MIT", | ||
"funding": "https://github.com/sponsors/antfu", | ||
"homepage": "https://github.com/vitest-dev/vitest#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vitest-dev/vitest.git", | ||
"directory": "packages/coverage-c8" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/vitest-dev/vitest/issues" | ||
}, | ||
"keywords": [ | ||
"vite", | ||
"vitest", | ||
"test", | ||
"coverage", | ||
"c8" | ||
], | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "rimraf dist && rollup -c", | ||
"dev": "rollup -c --watch --watch.include=src/**" | ||
}, | ||
"dependencies": { | ||
"c8": "^7.12.0", | ||
"vitest": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"vite-node": "workspace:*" | ||
} | ||
} |
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,62 @@ | ||
import { builtinModules } from 'module' | ||
import esbuild from 'rollup-plugin-esbuild' | ||
import dts from 'rollup-plugin-dts' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import json from '@rollup/plugin-json' | ||
import alias from '@rollup/plugin-alias' | ||
import nodeResolve from '@rollup/plugin-node-resolve' | ||
import { join } from 'pathe' | ||
import pkg from './package.json' | ||
|
||
const entries = { | ||
index: 'src/index.ts', | ||
} | ||
|
||
const external = [ | ||
...builtinModules, | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
'c8/lib/report.js', | ||
'c8/lib/commands/check-coverage.js', | ||
'vitest', | ||
'vitest/node', | ||
'vitest/config', | ||
] | ||
|
||
const plugins = [ | ||
alias({ | ||
entries: [ | ||
{ find: /^node:(.+)$/, replacement: '$1' }, | ||
], | ||
}), | ||
nodeResolve(), | ||
json(), | ||
commonjs(), | ||
esbuild({ | ||
target: 'node14', | ||
}), | ||
] | ||
|
||
export default () => [ | ||
{ | ||
input: entries, | ||
output: { | ||
dir: 'dist', | ||
format: 'esm', | ||
}, | ||
external, | ||
plugins, | ||
}, | ||
{ | ||
input: entries, | ||
output: { | ||
dir: join(process.cwd(), 'dist'), | ||
entryFileNames: '[name].d.ts', | ||
format: 'esm', | ||
}, | ||
external, | ||
plugins: [ | ||
dts({ respectExternal: true }), | ||
], | ||
}, | ||
] |
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,6 @@ | ||
export * from './takeCoverage' | ||
|
||
export async function getProvider() { | ||
const { C8CoverageProvider } = await import('./provider') | ||
return new C8CoverageProvider() | ||
} |
Oops, something went wrong.