Separate The Coverage Hit And Map Data
End-to-end testing generates a large volume of coverage data. We recommend separating hit
from map
data.
To achieve this, you need to:
- Configure
keepMap
asfalse
in the Babel plugin. - Report the map data in the pipeline.
Babel Plugin Update
module.exports = {
plugins: process.env.CI_COMMIT_REF_NAME === 'test-coverage' ? [
'istanbul',
['canyon', { keepMap: false }],
]:[],
};
Report map data in the pipeline
The following is an example of GitHub Actions.
For the usage of canyon-uploader
, please refer to its documentation.
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm i -g canyon-uploader && npm install
- name: Build
run: npm run build
- name: Upload coverage map
run: canyon-uploader map --dsn=https://xxx.com/coverage/map/client --provider=github