-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swc-plugin-canyon): update readme
- Loading branch information
1 parent
d1c0966
commit aae5e27
Showing
2 changed files
with
60 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# swc-plugin-canyon | ||
|
||
A swc plugin that instruments your code with Istanbul coverage. It can instantly be used with karma-coverage and mocha on Node.js (through nyc). | ||
|
||
__Note:__ To use this plugin, it is recommended to use a branch to determine whether it is in effect or not, as he is not available for production environments. | ||
|
||
## Usage | ||
|
||
Install it: | ||
|
||
```sh | ||
npm install --save-dev swc-plugin-istanbul | ||
``` | ||
|
||
Add it to `swc.config.js` in test mode: | ||
|
||
```js | ||
module.exports = { | ||
plugins: | ||
process.env.CI_COMMIT_REF_NAME === 'test-coverage'? ['istanbul', 'canyon']:[] | ||
} | ||
``` | ||
|
||
## Configuration | ||
|
||
swc.config.js | ||
|
||
```js | ||
module.exports = { | ||
plugins:[ | ||
'istanbul', | ||
[ | ||
'canyon', | ||
{ | ||
dsn: 'http://yourdomain.com/coverage/client', | ||
reporter: 'your_token', | ||
projectID: '230614', | ||
sha: 'xxxxxxxxx', | ||
reportID: 'case_id', | ||
branch: 'master', | ||
compareTarget: 'develop', | ||
} | ||
] | ||
] | ||
} | ||
``` | ||
|
||
| Prop | Description | Usage | | ||
|-----------|-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------| | ||
| dsn | Service address for reporting coverage, recommended to be configured via pipeline variables. | Required | | ||
| reporter | Reporter for reporting coverage, recommended to be configured via pipeline variables. | Required | | ||
| projectID | Git repository ID, the plugin will detect the variables of the pipeline, which usually don't need to be configured. | Required | | ||
| sha | Git repository SHA, the plugin will detect the variables of the pipeline, which usually don't need to be configured. | Required | | ||
| instrumentCwd | Instrument Cwd, which usually don't need to be configured. | Required | | ||
| reportID | Report ID, Used to distinguish between different test cases. | Optional | | ||
| branch | Git repository branch, the plugin will detect the variables of the pipeline, which usually don't need to be configured. | Optional | | ||
| compareTarget | Compare target, used as a baseline against current sha to calculate change line coverage. | Optional | | ||
|
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