From 4c3cbdc64d41d164f4d78766001a82730e50b481 Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Thu, 30 May 2024 23:13:25 +0200 Subject: [PATCH] fix: add code coverage npm scripts --- .c8rc | 5 +++++ packages/compat/package.json | 4 +++- packages/config-array/package.json | 4 +++- packages/object-schema/package.json | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .c8rc diff --git a/.c8rc b/.c8rc new file mode 100644 index 00000000..c8082b8e --- /dev/null +++ b/.c8rc @@ -0,0 +1,5 @@ +{ + "include": ["src/**/*.js"], + "reporter": ["lcov", "text-summary", "cobertura"], + "sourceMap": true +} diff --git a/packages/compat/package.json b/packages/compat/package.json index 82d6e982..70db0653 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -26,7 +26,8 @@ "build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"", "build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts", "test:jsr": "npx jsr@latest publish --dry-run", - "test": "mocha tests/*.js" + "test": "mocha tests/*.js", + "test:coverage": "c8 npm test" }, "repository": { "type": "git", @@ -46,6 +47,7 @@ "homepage": "https://github.com/eslint/rewrite#readme", "devDependencies": { "@types/eslint": "^8.56.10", + "c8": "^9.1.0", "eslint": "^9.0.0", "mocha": "^10.4.0", "rollup": "^4.16.2", diff --git a/packages/config-array/package.json b/packages/config-array/package.json index d8e16f3f..8936f060 100644 --- a/packages/config-array/package.json +++ b/packages/config-array/package.json @@ -34,7 +34,8 @@ "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", "test:jsr": "npx jsr@latest publish --dry-run", "pretest": "npm run build", - "test": "mocha tests/" + "test": "mocha tests/", + "test:coverage": "c8 npm test" }, "keywords": [ "configuration", @@ -49,6 +50,7 @@ }, "devDependencies": { "@types/minimatch": "^3.0.5", + "c8": "^9.1.0", "mocha": "^10.4.0", "rollup": "^4.16.2", "rollup-plugin-copy": "^3.5.0", diff --git a/packages/object-schema/package.json b/packages/object-schema/package.json index a56dd78b..8219d8c2 100644 --- a/packages/object-schema/package.json +++ b/packages/object-schema/package.json @@ -26,7 +26,8 @@ "build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"", "build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts", "test:jsr": "npx jsr@latest publish --dry-run", - "test": "mocha tests/" + "test": "mocha tests/", + "test:coverage": "c8 npm test" }, "repository": { "type": "git", @@ -45,10 +46,11 @@ }, "homepage": "https://github.com/eslint/rewrite#readme", "devDependencies": { + "c8": "^9.1.0", "mocha": "^10.4.0", "rollup": "^4.16.2", - "typescript": "^5.4.5", - "rollup-plugin-copy": "^3.5.0" + "rollup-plugin-copy": "^3.5.0", + "typescript": "^5.4.5" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0"