-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add istanbul coverage provider #399
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
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
packages/core/package.json
Outdated
"pathe": "^2.0.3", | ||
"std-env": "^3.9.0", | ||
"swc-plugin-coverage-instrument": "^0.0.28", |
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.
Builtin istanbul coverage directly into Rstest is too heavy. Rstest can provide a separate package for users to install as needed. When users set provider: 'istanbul'
, rstest can import the relevant transform plugin and provider from @rstest/coverage-istanbul
.
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.
👌
packages/core/src/core/rsbuild.ts
Outdated
@@ -221,6 +222,27 @@ export const prepareRsbuild = async ( | |||
...(config.module.parser.javascript || {}), | |||
}; | |||
|
|||
if (coverage?.enabled && coverage?.provider === 'istanbul') { | |||
const swcPluginCoverageInstrument = `${process.cwd()}/node_modules/@rstest/coverage-istanbul/node_modules/swc-plugin-coverage-instrument/target/wasm32-wasip1/release/swc_plugin_coverage.wasm`; |
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.
packages/core/src/core/rsbuild.ts
Outdated
config.module.rules ??= []; | ||
config.module.rules.push({ | ||
test: /\.(js|ts)$/, | ||
exclude: [/node_modules/], |
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.
some test files should be excluded.
packages/core/src/coverage/index.ts
Outdated
@@ -0,0 +1,23 @@ | |||
import type { CoverageOptions } from '../types/coverage'; | |||
import type { CoverageProvider } from './istanbul'; | |||
import { IstanbulCoverageProvider } from './istanbul'; |
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.
IstanbulCoverageProvider
should also extract to @rstest/coverage-istanbul
Summary
add istanbul coverage provider.
Related Links
#398
Checklist