From 60ed99896522e5b65bb82371e6a9c9eede903a60 Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Fri, 24 Jan 2025 07:03:18 -0500 Subject: [PATCH] Switch `c8` to `@vitest/coverage-v8` (#3845) * switch c8 to `@vitest/coverage-v8` * Fix some client coverage issues * fix timeouts * skip coverage config * Remove unused scripts and turn on lcov * fix config * Skip cli tests --------- Co-authored-by: Jochem Brouwer --- config/eslint.cjs | 1 + config/vitest.config.coverage.mts | 18 ++ package-lock.json | 165 +----------------- package.json | 3 +- packages/block/package.json | 2 +- packages/blockchain/package.json | 2 +- packages/client/package.json | 2 +- .../client/test/execution/vmexecution.spec.ts | 2 +- .../client/test/rpc/debug/setHead.spec.ts | 2 +- .../client/test/rpc/eth/estimateGas.spec.ts | 2 +- .../client/test/rpc/eth/getBalance.spec.ts | 2 +- .../test/rpc/eth/getTransactionCount.spec.ts | 4 +- packages/client/vitest.config.coverage.ts | 19 ++ packages/common/package.json | 2 +- packages/devp2p/package.json | 2 +- packages/ethash/package.json | 2 +- packages/evm/package.json | 3 +- packages/genesis/package.json | 2 +- packages/mpt/package.json | 2 +- packages/rlp/package.json | 2 +- packages/statemanager/package.json | 2 +- packages/tx/package.json | 2 +- packages/util/package.json | 2 +- packages/verkle/package.json | 2 +- packages/vm/package.json | 3 +- packages/vm/vitest.config.coverage.ts | 18 ++ .../vm/{vite.config.ts => vitest.config.ts} | 0 packages/wallet/package.json | 2 +- 28 files changed, 80 insertions(+), 190 deletions(-) create mode 100644 config/vitest.config.coverage.mts create mode 100644 packages/client/vitest.config.coverage.ts create mode 100644 packages/vm/vitest.config.coverage.ts rename packages/vm/{vite.config.ts => vitest.config.ts} (100%) diff --git a/config/eslint.cjs b/config/eslint.cjs index 0838ffbacb..050d7d2af8 100644 --- a/config/eslint.cjs +++ b/config/eslint.cjs @@ -26,6 +26,7 @@ module.exports = { 'vitest.config.ts', 'vitest.config.browser.ts', 'vitest.config.unit.ts', + 'vitest.config.coverage.ts', 'vite.*.ts', 'ethereum-tests', 'archive', diff --git a/config/vitest.config.coverage.mts b/config/vitest.config.coverage.mts new file mode 100644 index 0000000000..15c570662b --- /dev/null +++ b/config/vitest.config.coverage.mts @@ -0,0 +1,18 @@ +import { defineConfig } from 'vitest/config' + +const config = defineConfig({ + test: { + silent: true, + testTimeout: 180000, + coverage: { + provider: 'v8', + enabled: true, + all: true, + }, + }, + optimizeDeps: { + exclude: ['kzg-wasm'], + }, +}) + +export default config \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 05b7c282a9..a9861f5325 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,9 +16,8 @@ "@types/tape": "4.13.2", "@typescript-eslint/eslint-plugin": "5.33.1", "@typescript-eslint/parser": "5.33.1", - "@vitest/coverage-v8": "3.0.2", + "@vitest/coverage-v8": "^3.0.2", "@vitest/ui": "3.0.2", - "c8": "7.12.0", "cspell": "^8.13.3", "embedme": "1.22.1", "eslint": "8.57.0", @@ -487,12 +486,6 @@ "node": ">=6.9.0" } }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, "node_modules/@biomejs/biome": { "version": "1.9.4", "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", @@ -3496,12 +3489,6 @@ "@types/unist": "*" } }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", - "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "dev": true - }, "node_modules/@types/js-md5": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@types/js-md5/-/js-md5-0.4.3.tgz", @@ -5269,46 +5256,6 @@ "node": ">= 0.8" } }, - "node_modules/c8": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-7.12.0.tgz", - "integrity": "sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==", - "dev": true, - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@istanbuljs/schema": "^0.1.3", - "find-up": "^5.0.0", - "foreground-child": "^2.0.0", - "istanbul-lib-coverage": "^3.2.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-reports": "^3.1.4", - "rimraf": "^3.0.2", - "test-exclude": "^6.0.0", - "v8-to-istanbul": "^9.0.0", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9" - }, - "bin": { - "c8": "bin/c8.js" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/c8/node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -5638,46 +5585,6 @@ "node": ">= 12" } }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/color": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", @@ -15352,20 +15259,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-to-istanbul": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", - "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -16530,62 +16423,6 @@ "node": ">= 14" } }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", diff --git a/package.json b/package.json index 3232be7a56..cd1c6933af 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,8 @@ "@types/tape": "4.13.2", "@typescript-eslint/eslint-plugin": "5.33.1", "@typescript-eslint/parser": "5.33.1", - "@vitest/coverage-v8": "3.0.2", + "@vitest/coverage-v8": "^3.0.2", "@vitest/ui": "3.0.2", - "c8": "7.12.0", "cspell": "^8.13.3", "embedme": "1.22.1", "eslint": "8.57.0", diff --git a/packages/block/package.json b/packages/block/package.json index e3fd19928f..4b7cef9f8d 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -29,7 +29,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- block", "examples:build": "npx embedme README.md", diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index ef4f2b58e9..f72256c6ed 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -29,7 +29,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- blockchain", "examples:build": "npx embedme README.md", diff --git a/packages/client/package.json b/packages/client/package.json index a756f33fdc..6fc69594b5 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -33,7 +33,7 @@ "client:start": "npm run client:start:js --", "client:start:dev1": "npm run client:start -- --discDns=false --discV4=false --bootnodes", "client:start:dev2": "npm run client:start -- --discDns=false --discV4=false --port=30304 --dataDir=datadir-dev2", - "coverage": "npx vitest --coverage --coverage.include=src --coverage.reporter=lcov run test/* -c=./vitest.config.unit.ts", + "coverage": "DEBUG=ethjs npx vitest run -c ./vitest.config.coverage.ts", "docs:build": "typedoc --options typedoc.cjs --tsconfig tsconfig.prod.cjs.json", "examples": "tsx ../../scripts/examples-runner.ts -- client", "lint": "npm run biome && eslint --config .eslintrc.cjs . --ext .js,.ts", diff --git a/packages/client/test/execution/vmexecution.spec.ts b/packages/client/test/execution/vmexecution.spec.ts index 50c9db8fd6..cef68c1acc 100644 --- a/packages/client/test/execution/vmexecution.spec.ts +++ b/packages/client/test/execution/vmexecution.spec.ts @@ -224,4 +224,4 @@ describe('[VMExecution]', () => { closeRPC(server) }) -}, 30000) +}) diff --git a/packages/client/test/rpc/debug/setHead.spec.ts b/packages/client/test/rpc/debug/setHead.spec.ts index 48fa950b14..966602d0db 100644 --- a/packages/client/test/rpc/debug/setHead.spec.ts +++ b/packages/client/test/rpc/debug/setHead.spec.ts @@ -44,7 +44,7 @@ describe(method, async () => { `vm execution should set hash to new head`, ) } - }, 30000) + }) it('should return error for pending block', async () => { const blockchain = await createBlockchainFromBlocksData(mainnetData, { diff --git a/packages/client/test/rpc/eth/estimateGas.spec.ts b/packages/client/test/rpc/eth/estimateGas.spec.ts index aae630f830..a29aabc908 100644 --- a/packages/client/test/rpc/eth/estimateGas.spec.ts +++ b/packages/client/test/rpc/eth/estimateGas.spec.ts @@ -210,4 +210,4 @@ describe(method, () => { assert.equal(res.error.code, INVALID_PARAMS) assert.ok(res.error.message.includes('"pending" is not yet supported')) }) -}, 20000) +}) diff --git a/packages/client/test/rpc/eth/getBalance.spec.ts b/packages/client/test/rpc/eth/getBalance.spec.ts index 0a3fdc29cb..383eb79b79 100644 --- a/packages/client/test/rpc/eth/getBalance.spec.ts +++ b/packages/client/test/rpc/eth/getBalance.spec.ts @@ -100,4 +100,4 @@ describe(method, () => { assert.equal(res.error.code, INVALID_PARAMS) assert.ok(res.error.message.includes('"pending" is not yet supported')) }) -}, 40000) +}) diff --git a/packages/client/test/rpc/eth/getTransactionCount.spec.ts b/packages/client/test/rpc/eth/getTransactionCount.spec.ts index 0132efbdb7..32b0916ccd 100644 --- a/packages/client/test/rpc/eth/getTransactionCount.spec.ts +++ b/packages/client/test/rpc/eth/getTransactionCount.spec.ts @@ -78,7 +78,7 @@ describe(method, () => { // call with nonexistent account res = await rpc.request(method, [`0x${'11'.repeat(20)}`, 'latest']) assert.equal(res.result, `0x0`, 'should return 0x0 for nonexistent account') - }, 40000) + }) it('call with pending block argument', async () => { const blockchain = await createBlockchain() @@ -109,5 +109,5 @@ describe(method, () => { const res = await rpc.request(method, [address.toString(), 'pending']) assert.equal(res.result, '0x1') - }, 40000) + }) }) diff --git a/packages/client/vitest.config.coverage.ts b/packages/client/vitest.config.coverage.ts new file mode 100644 index 0000000000..d62c2d4258 --- /dev/null +++ b/packages/client/vitest.config.coverage.ts @@ -0,0 +1,19 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + silent: true, + exclude: ['test/integration', 'test/sim', 'test/cli/*.spec.ts', 'test/logging.spec.ts'], + testTimeout: 300000, + alias: { '@polkadot/util': 'false' }, + typecheck: { + tsconfig: './tsconfig.prod.esm.json', + }, + coverage: { + provider: 'v8', + enabled: true, + all: true, + reporter: ['lcov'], + }, + }, +}) diff --git a/packages/common/package.json b/packages/common/package.json index 7bba7cafcc..928dcc3a31 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -42,7 +42,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- common", "examples:build": "npx embedme README.md", diff --git a/packages/devp2p/package.json b/packages/devp2p/package.json index e5a65cdd2c..8324f12a6d 100644 --- a/packages/devp2p/package.json +++ b/packages/devp2p/package.json @@ -45,7 +45,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- devp2p", "examples:build": "npx embedme README.md", diff --git a/packages/ethash/package.json b/packages/ethash/package.json index 0e814659c9..bdc4169edc 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -29,7 +29,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "npx vitest --coverage --coverage.include=src --coverage.reporter=lcov run test/*", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- ethash", "examples:build": "npx embedme README.md", diff --git a/packages/evm/package.json b/packages/evm/package.json index def57f5591..876a3303df 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -30,8 +30,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", - "coverage:test": "npm run test:node && cd ../vm && npm run tester -- --state", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- evm", "examples:build": "npx embedme README.md", diff --git a/packages/genesis/package.json b/packages/genesis/package.json index 1ee1a72fde..a978a658a0 100644 --- a/packages/genesis/package.json +++ b/packages/genesis/package.json @@ -41,7 +41,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "examples": "tsx ../../scripts/examples-runner.ts -- genesis", "examples:build": "npx embedme README.md", "docs:build": "typedoc --options typedoc.cjs", diff --git a/packages/mpt/package.json b/packages/mpt/package.json index b6a99a52cf..9a120dcf85 100644 --- a/packages/mpt/package.json +++ b/packages/mpt/package.json @@ -31,7 +31,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- mpt", "examples:build": "npx embedme README.md", diff --git a/packages/rlp/package.json b/packages/rlp/package.json index ff86afc861..426dea7015 100644 --- a/packages/rlp/package.json +++ b/packages/rlp/package.json @@ -42,7 +42,7 @@ "build": "../../config/cli/ts-build.sh node", "build:benchmarks": "npm run build && tsc -p tsconfig.benchmarks.json", "clean": "../../config/cli/clean-package.sh", - "coverage": "npx vitest --coverage --coverage.include=src run", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "examples": "tsx ../../scripts/examples-runner.ts -- rlp", "examples:build": "npx embedme README.md", "lint": "npm run biome && eslint --config .eslintrc.cjs . --ext .js,.ts", diff --git a/packages/statemanager/package.json b/packages/statemanager/package.json index e3c7b1dd32..39b46456b8 100644 --- a/packages/statemanager/package.json +++ b/packages/statemanager/package.json @@ -30,7 +30,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- statemanager", "examples:build": "npx embedme README.md", diff --git a/packages/tx/package.json b/packages/tx/package.json index 641ffc85b6..adf1596e70 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -36,7 +36,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- tx", "examples:build": "npx embedme README.md", diff --git a/packages/util/package.json b/packages/util/package.json index b98db657dd..fb3513904b 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -73,7 +73,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "npx typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- util", "examples:build": "npx embedme README.md", diff --git a/packages/verkle/package.json b/packages/verkle/package.json index a5bd4a8c4f..e3eba78ea5 100644 --- a/packages/verkle/package.json +++ b/packages/verkle/package.json @@ -35,7 +35,7 @@ "biome:fix": "npx @biomejs/biome check --write", "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- verkle", "examples:build": "npx embedme README.md", diff --git a/packages/vm/package.json b/packages/vm/package.json index f9f66414dd..31e0fc9587 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -32,8 +32,7 @@ "build": "../../config/cli/ts-build.sh", "build:benchmarks": "npm run build && tsc -p tsconfig.benchmarks.json", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", - "coverage:test": "npm run test:API", + "coverage": "DEBUG=ethjs npx vitest run -c ./vitest.config.coverage.ts", "docs:build": "typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- vm", "examples:build": "npx embedme README.md", diff --git a/packages/vm/vitest.config.coverage.ts b/packages/vm/vitest.config.coverage.ts new file mode 100644 index 0000000000..6af50d7af1 --- /dev/null +++ b/packages/vm/vitest.config.coverage.ts @@ -0,0 +1,18 @@ +import topLevelAwait from 'vite-plugin-top-level-await' +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + plugins: [topLevelAwait()], + optimizeDeps: { + exclude: ['kzg-wasm'], + }, + test: { + exclude: ['test/api/t8ntool'], + coverage: { + provider: 'v8', + enabled: true, + all: true, + reporter: ['lcov'], + }, + }, +}) diff --git a/packages/vm/vite.config.ts b/packages/vm/vitest.config.ts similarity index 100% rename from packages/vm/vite.config.ts rename to packages/vm/vitest.config.ts diff --git a/packages/wallet/package.json b/packages/wallet/package.json index f829035ddb..584f32b507 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -27,7 +27,7 @@ "scripts": { "build": "../../config/cli/ts-build.sh", "clean": "../../config/cli/clean-package.sh", - "coverage": "DEBUG=ethjs npx vitest run --coverage.enabled --coverage.reporter=lcov", + "coverage": "DEBUG=ethjs npx vitest run -c ../../config/vitest.config.coverage.mts", "docs:build": "npx typedoc --options typedoc.cjs", "examples": "tsx ../../scripts/examples-runner.ts -- wallet", "examples:build": "npx embedme README.md",