diff --git a/.gitignore b/.gitignore index 8366b82..d9cc783 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ node_modules/ .turbo/ # Build -dist/ \ No newline at end of file +dist/ + +# Coverage +coverage/ \ No newline at end of file diff --git a/package.json b/package.json index 66f1145..abfffdc 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "build": "turbo run build", "test": "turbo run test", + "coverage": "turbo run coverage", "prepare": "husky", "lint": "turbo run lint", "lint:fix": "turbo run lint:fix", @@ -21,6 +22,7 @@ "@ianvs/prettier-plugin-sort-imports": "4.3.1", "@typescript-eslint/eslint-plugin": "7.16.1", "@typescript-eslint/parser": "7.16.1", + "@vitest/coverage-v8": "^2.0.3", "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", diff --git a/packages/blocknumber/package.json b/packages/blocknumber/package.json index 9ddd104..90949f5 100644 --- a/packages/blocknumber/package.json +++ b/packages/blocknumber/package.json @@ -10,7 +10,8 @@ "lint:fix": "pnpm lint --fix", "format": "prettier --check .", "format:fix": "prettier --write .", - "test": "vitest run" + "test": "vitest run", + "coverage": "vitest run --coverage" }, "keywords": [], "author": "", diff --git a/packages/blocknumber/vitest.config.ts b/packages/blocknumber/vitest.config.ts index 84e59e7..fec3430 100644 --- a/packages/blocknumber/vitest.config.ts +++ b/packages/blocknumber/vitest.config.ts @@ -8,6 +8,7 @@ export default defineConfig({ include: ["src/**/*.spec.ts"], // Include test files exclude: ["node_modules", "dist"], // Exclude certain directories coverage: { + provider: "v8", reporter: ["text", "json", "html"], // Coverage reporters exclude: ["node_modules", "dist", "src/**/*.d.ts"], // Files to exclude from coverage }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 36a1010..56d01ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ importers: "@typescript-eslint/parser": specifier: 7.16.1 version: 7.16.1(eslint@8.57.0)(typescript@5.5.3) + "@vitest/coverage-v8": + specifier: ^2.0.3 + version: 2.0.3(vitest@2.0.3(@types/node@20.14.11)) eslint: specifier: 8.57.0 version: 8.57.0 @@ -50,6 +53,8 @@ importers: specifier: 2.0.3 version: 2.0.3(@types/node@20.14.11) + packages/blocknumber: {} + packages: "@ampproject/remapping@2.3.0": resolution: @@ -208,6 +213,12 @@ packages: } engines: { node: ">=6.9.0" } + "@bcoe/v8-coverage@0.2.3": + resolution: + { + integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==, + } + "@commitlint/cli@19.3.0": resolution: { @@ -599,6 +610,20 @@ packages: "@vue/compiler-sfc": optional: true + "@isaacs/cliui@8.0.2": + resolution: + { + integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==, + } + engines: { node: ">=12" } + + "@istanbuljs/schema@0.1.3": + resolution: + { + integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==, + } + engines: { node: ">=8" } + "@jridgewell/gen-mapping@0.3.5": resolution: { @@ -653,6 +678,13 @@ packages: } engines: { node: ">= 8" } + "@pkgjs/parseargs@0.11.0": + resolution: + { + integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==, + } + engines: { node: ">=14" } + "@pkgr/core@0.1.1": resolution: { @@ -894,6 +926,14 @@ packages: integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==, } + "@vitest/coverage-v8@2.0.3": + resolution: + { + integrity: sha512-53d+6jXFdYbasXBmsL6qaGIfcY5eBQq0sP57AjdasOcSiGNj4qxkkpDKIitUNfjxcfAfUfQ8BD0OR2fSey64+g==, + } + peerDependencies: + vitest: 2.0.3 + "@vitest/expect@2.0.3": resolution: { @@ -1303,6 +1343,12 @@ packages: } engines: { node: ">=8" } + eastasianwidth@0.2.0: + resolution: + { + integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==, + } + electron-to-chromium@1.4.829: resolution: { @@ -1321,6 +1367,12 @@ packages: integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==, } + emoji-regex@9.2.2: + resolution: + { + integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==, + } + env-paths@2.2.1: resolution: { @@ -1549,6 +1601,13 @@ packages: integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==, } + foreground-child@3.2.1: + resolution: + { + integrity: sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==, + } + engines: { node: ">=14" } + fs.realpath@1.0.0: resolution: { @@ -1619,6 +1678,13 @@ packages: } engines: { node: ">=10.13.0" } + glob@10.4.5: + resolution: + { + integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==, + } + hasBin: true + glob@7.2.3: resolution: { @@ -1674,6 +1740,12 @@ packages: } engines: { node: ">=8" } + html-escaper@2.0.2: + resolution: + { + integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==, + } + human-signals@5.0.0: resolution: { @@ -1818,6 +1890,40 @@ packages: integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==, } + istanbul-lib-coverage@3.2.2: + resolution: + { + integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==, + } + engines: { node: ">=8" } + + istanbul-lib-report@3.0.1: + resolution: + { + integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==, + } + engines: { node: ">=10" } + + istanbul-lib-source-maps@5.0.6: + resolution: + { + integrity: sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==, + } + engines: { node: ">=10" } + + istanbul-reports@3.1.7: + resolution: + { + integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==, + } + engines: { node: ">=8" } + + jackspeak@3.4.3: + resolution: + { + integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==, + } + jiti@1.21.6: resolution: { @@ -1831,6 +1937,12 @@ packages: integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==, } + js-tokens@9.0.0: + resolution: + { + integrity: sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==, + } + js-yaml@4.1.0: resolution: { @@ -2013,6 +2125,12 @@ packages: integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==, } + lru-cache@10.4.3: + resolution: + { + integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==, + } + lru-cache@5.1.1: resolution: { @@ -2025,6 +2143,19 @@ packages: integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==, } + magicast@0.3.4: + resolution: + { + integrity: sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==, + } + + make-dir@4.0.0: + resolution: + { + integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==, + } + engines: { node: ">=10" } + meow@12.1.1: resolution: { @@ -2085,6 +2216,13 @@ packages: integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==, } + minipass@7.1.2: + resolution: + { + integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==, + } + engines: { node: ">=16 || 14 >=14.17" } + ms@2.1.2: resolution: { @@ -2173,6 +2311,12 @@ packages: } engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } + package-json-from-dist@1.0.0: + resolution: + { + integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==, + } + parent-module@1.0.1: resolution: { @@ -2222,6 +2366,13 @@ packages: } engines: { node: ">=12" } + path-scurry@1.11.1: + resolution: + { + integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==, + } + engines: { node: ">=16 || 14 >=14.18" } + path-type@4.0.0: resolution: { @@ -2484,6 +2635,13 @@ packages: } engines: { node: ">=8" } + string-width@5.1.2: + resolution: + { + integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==, + } + engines: { node: ">=12" } + string-width@7.2.0: resolution: { @@ -2519,6 +2677,12 @@ packages: } engines: { node: ">=8" } + strip-literal@2.1.0: + resolution: + { + integrity: sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==, + } + supports-color@5.5.0: resolution: { @@ -2540,6 +2704,13 @@ packages: } engines: { node: ^14.18.0 || >=16.0.0 } + test-exclude@7.0.1: + resolution: + { + integrity: sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==, + } + engines: { node: ">=18" } + text-extensions@2.4.0: resolution: { @@ -2817,6 +2988,13 @@ packages: } engines: { node: ">=10" } + wrap-ansi@8.1.0: + resolution: + { + integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==, + } + engines: { node: ">=12" } + wrap-ansi@9.0.0: resolution: { @@ -3018,6 +3196,8 @@ snapshots: "@babel/helper-validator-identifier": 7.24.7 to-fast-properties: 2.0.0 + "@bcoe/v8-coverage@0.2.3": {} + "@commitlint/cli@19.3.0(@types/node@20.14.11)(typescript@5.5.3)": dependencies: "@commitlint/format": 19.3.0 @@ -3245,6 +3425,17 @@ snapshots: transitivePeerDependencies: - supports-color + "@isaacs/cliui@8.0.2": + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + "@istanbuljs/schema@0.1.3": {} + "@jridgewell/gen-mapping@0.3.5": dependencies: "@jridgewell/set-array": 1.2.1 @@ -3274,6 +3465,9 @@ snapshots: "@nodelib/fs.scandir": 2.1.5 fastq: 1.17.1 + "@pkgjs/parseargs@0.11.0": + optional: true + "@pkgr/core@0.1.1": {} "@rollup/rollup-android-arm-eabi@4.18.1": @@ -3417,6 +3611,25 @@ snapshots: "@ungap/structured-clone@1.2.0": {} + "@vitest/coverage-v8@2.0.3(vitest@2.0.3(@types/node@20.14.11))": + dependencies: + "@ampproject/remapping": 2.3.0 + "@bcoe/v8-coverage": 0.2.3 + debug: 4.3.5 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 5.0.6 + istanbul-reports: 3.1.7 + magic-string: 0.30.10 + magicast: 0.3.4 + std-env: 3.7.0 + strip-literal: 2.1.0 + test-exclude: 7.0.1 + tinyrainbow: 1.2.0 + vitest: 2.0.3(@types/node@20.14.11) + transitivePeerDependencies: + - supports-color + "@vitest/expect@2.0.3": dependencies: "@vitest/spy": 2.0.3 @@ -3649,12 +3862,16 @@ snapshots: dependencies: is-obj: 2.0.0 + eastasianwidth@0.2.0: {} + electron-to-chromium@1.4.829: {} emoji-regex@10.3.0: {} emoji-regex@8.0.0: {} + emoji-regex@9.2.2: {} + env-paths@2.2.1: {} error-ex@1.3.2: @@ -3841,6 +4058,11 @@ snapshots: flatted@3.3.1: {} + foreground-child@3.2.1: + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + fs.realpath@1.0.0: {} fsevents@2.3.3: @@ -3870,6 +4092,15 @@ snapshots: dependencies: is-glob: 4.0.3 + glob@10.4.5: + dependencies: + foreground-child: 3.2.1 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.0 + path-scurry: 1.11.1 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -3904,6 +4135,8 @@ snapshots: has-flag@4.0.0: {} + html-escaper@2.0.2: {} + human-signals@5.0.0: {} husky@9.1.0: {} @@ -3958,10 +4191,39 @@ snapshots: isexe@2.0.0: {} + istanbul-lib-coverage@3.2.2: {} + + istanbul-lib-report@3.0.1: + dependencies: + istanbul-lib-coverage: 3.2.2 + make-dir: 4.0.0 + supports-color: 7.2.0 + + istanbul-lib-source-maps@5.0.6: + dependencies: + "@jridgewell/trace-mapping": 0.3.25 + debug: 4.3.5 + istanbul-lib-coverage: 3.2.2 + transitivePeerDependencies: + - supports-color + + istanbul-reports@3.1.7: + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + + jackspeak@3.4.3: + dependencies: + "@isaacs/cliui": 8.0.2 + optionalDependencies: + "@pkgjs/parseargs": 0.11.0 + jiti@1.21.6: {} js-tokens@4.0.0: {} + js-tokens@9.0.0: {} + js-yaml@4.1.0: dependencies: argparse: 2.0.1 @@ -4057,6 +4319,8 @@ snapshots: dependencies: get-func-name: 2.0.2 + lru-cache@10.4.3: {} + lru-cache@5.1.1: dependencies: yallist: 3.1.1 @@ -4065,6 +4329,16 @@ snapshots: dependencies: "@jridgewell/sourcemap-codec": 1.5.0 + magicast@0.3.4: + dependencies: + "@babel/parser": 7.24.8 + "@babel/types": 7.24.9 + source-map-js: 1.2.0 + + make-dir@4.0.0: + dependencies: + semver: 7.6.3 + meow@12.1.1: {} merge-stream@2.0.0: {} @@ -4090,6 +4364,8 @@ snapshots: minimist@1.2.8: {} + minipass@7.1.2: {} + ms@2.1.2: {} nanoid@3.3.7: {} @@ -4139,6 +4415,8 @@ snapshots: dependencies: p-limit: 4.0.0 + package-json-from-dist@1.0.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -4160,6 +4438,11 @@ snapshots: path-key@4.0.0: {} + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + path-type@4.0.0: {} pathe@1.1.2: {} @@ -4281,6 +4564,12 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + string-width@7.2.0: dependencies: emoji-regex: 10.3.0 @@ -4299,6 +4588,10 @@ snapshots: strip-json-comments@3.1.1: {} + strip-literal@2.1.0: + dependencies: + js-tokens: 9.0.0 + supports-color@5.5.0: dependencies: has-flag: 3.0.0 @@ -4312,6 +4605,12 @@ snapshots: "@pkgr/core": 0.1.1 tslib: 2.6.3 + test-exclude@7.0.1: + dependencies: + "@istanbuljs/schema": 0.1.3 + glob: 10.4.5 + minimatch: 9.0.5 + text-extensions@2.4.0: {} text-table@0.2.0: {} @@ -4462,6 +4761,12 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + wrap-ansi@9.0.0: dependencies: ansi-styles: 6.2.1 diff --git a/turbo.json b/turbo.json index 692f067..541985e 100644 --- a/turbo.json +++ b/turbo.json @@ -6,6 +6,7 @@ "format": {}, "format:fix": {}, "test": {}, + "coverage": {}, "build": {} }, "globalDependencies": [".eslintrc", ".prettierrc"]