| 1 | import { execSync } from 'child_process'; |
| 2 | import { cp } from 'fs/promises'; |
| 3 | |
| 4 | const main = async () => { |
| 5 | const coverageDir = 'coverage'; |
| 6 | const coverageFiles = ['vitest', 'cypress'].map( |
| 7 | (dir) => `${coverageDir}/${dir}/coverage-final.json` |
| 8 | ); |
| 9 | |
| 10 | //copy coverage files from vitest and cypress to coverage folder |
| 11 | await Promise.all( |
| 12 | coverageFiles.map((file) => cp(file, `${coverageDir}/combined/${file.split('/')[1]}.json`)) |
| 13 | ); |
| 14 | |
| 15 | execSync('npx nyc merge coverage/combined coverage/combined-final.json'); |
| 16 | execSync('npx nyc report -t coverage --report-dir coverage/html --reporter=html-spa'); |
| 17 | }; |
| 18 | |
| 19 | void main(); |
| 20 | |