From: Jérôme Benoit Date: Tue, 24 Feb 2026 17:46:42 +0000 (+0100) Subject: fix: replace c8 with native Node.js test coverage X-Git-Tag: ocpp-server@v2.4.0~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=feb16c87a0b75ae9e188f3978c3d439e67122629;p=e-mobility-charging-stations-simulator.git fix: replace c8 with native Node.js test coverage - Remove c8 dependency (yargs@17.7.2 incompatible with Node.js 25) - Use --experimental-test-coverage for native coverage - Rename coverage script to test:coverage - Optimize CI to avoid double test runs on coverage matrix --- diff --git a/.c8rc.json b/.c8rc.json deleted file mode 100644 index da4ba8e5..00000000 --- a/.c8rc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "all": true, - "include": ["src/**/*.ts"] -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0521bae..d6c4290f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,10 +83,11 @@ jobs: - name: pnpm build run: pnpm build - name: pnpm test + if: ${{ !(github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x') }} run: pnpm test - - name: pnpm coverage + - name: pnpm test:coverage if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }} - run: pnpm coverage + run: pnpm test:coverage - name: SonarCloud Scan if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }} uses: sonarsource/sonarqube-scan-action@v7.0.0 @@ -134,10 +135,11 @@ jobs: - name: pnpm build run: pnpm build - name: pnpm test + if: ${{ !(github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x') }} run: pnpm test - - name: pnpm coverage + - name: pnpm test:coverage if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }} - run: pnpm coverage + run: pnpm test:coverage - name: SonarCloud Scan if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }} uses: sonarsource/sonarqube-scan-action@v7.0.0 diff --git a/.serena/memories/suggested_commands.md b/.serena/memories/suggested_commands.md index a78b259c..e8054b6d 100644 --- a/.serena/memories/suggested_commands.md +++ b/.serena/memories/suggested_commands.md @@ -31,8 +31,7 @@ pnpm start:dev:debug # Start with debugging enabled pnpm build:dev # Development build with source maps pnpm test # Run all tests pnpm test:debug # Run tests with debugging -pnpm coverage # Generate coverage report -pnpm coverage:html # Generate HTML coverage report +pnpm test:coverage # Generate coverage report ``` ### Code Quality diff --git a/.serena/memories/task_completion_checklist.md b/.serena/memories/task_completion_checklist.md index 3525aada..62e828d5 100644 --- a/.serena/memories/task_completion_checklist.md +++ b/.serena/memories/task_completion_checklist.md @@ -11,7 +11,7 @@ - [ ] Run `pnpm test` to ensure all tests pass - [ ] If new functionality added, ensure appropriate tests are included -- [ ] Check test coverage if relevant: `pnpm coverage` +- [ ] Check test coverage if relevant: `pnpm test:coverage` ### 3. Build Verification diff --git a/package.json b/package.json index c5dd91dc..b2705bcc 100644 --- a/package.json +++ b/package.json @@ -67,10 +67,9 @@ "lint": "cross-env TIMING=1 eslint --cache src tests scripts ./*.js ./*.ts", "lint:fix": "cross-env TIMING=1 eslint --cache --fix src tests scripts ./*.js ./*.ts", "format": "prettier --cache --write .; eslint --cache --fix src tests scripts ./*.js ./*.ts", - "test": "c8 node --import tsx --test tests/**/*.test.ts", + "test": "node --import tsx --test --experimental-test-coverage tests/**/*.test.ts", "test:debug": "node --import tsx --test --inspect tests/**/*.test.ts", - "coverage": "c8 report --reporter=lcov", - "coverage:html": "c8 report --reporter=html", + "test:coverage": "node --import tsx --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info tests/**/*.test.ts", "clinic:clean": "clinic clean", "sea": "pnpm exec rimraf ./dist/evse-simulator ./dist/evse-simulator.blob && node --experimental-sea-config sea-config.json && pnpm dlx ncp $(volta which node || n which lts || nvm which node || command -v node) ./dist/evse-simulator && pnpm dlx postject ./dist/evse-simulator NODE_SEA_BLOB ./dist/evse-simulator.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 && pnpm exec rimraf ./dist/evse-simulator.blob" }, @@ -108,7 +107,6 @@ "@types/node": "^24.10.13", "@types/semver": "^7.7.1", "@types/ws": "^8.18.1", - "c8": "^10.1.3", "clinic": "^13.0.0", "cross-env": "^10.1.0", "esbuild": "^0.27.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe7cb448..8ea3dae3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -102,9 +102,6 @@ importers: '@types/ws': specifier: ^8.18.1 version: 8.18.1 - c8: - specifier: ^10.1.3 - version: 10.1.3 clinic: specifier: ^13.0.0 version: 13.0.0(encoding@0.1.13) @@ -1004,10 +1001,6 @@ packages: resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} engines: {node: '>=18.0.0'} - '@istanbuljs/schema@0.1.3': - resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} - engines: {node: '>=8'} - '@jercle/yargonaut@1.1.5': resolution: {integrity: sha512-zBp2myVvBHp1UaJsNTyS6q4UDKT7eRiqTS4oNTS6VQMd6mpxYOdbeK4pY279cDCdakGy6hG0J3ejoXZVsPwHqw==} @@ -1353,9 +1346,6 @@ packages: '@types/http-cache-semantics@4.2.0': resolution: {integrity: sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==} - '@types/istanbul-lib-coverage@2.0.6': - resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} - '@types/jsdom@28.0.0': resolution: {integrity: sha512-A8TBQQC/xAOojy9kM8E46cqT00sF0h7dWjV8t8BJhUi2rG6JRh7XXQo/oLoENuZIQEpXsxLccLCnknyQd7qssQ==} @@ -1634,27 +1624,15 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@vue/compiler-core@3.5.28': - resolution: {integrity: sha512-kviccYxTgoE8n6OCw96BNdYlBg2GOWfBuOW4Vqwrt7mSKWKwFVvI8egdTltqRgITGPsTFYtKYfxIG8ptX2PJHQ==} - '@vue/compiler-core@3.5.29': resolution: {integrity: sha512-cuzPhD8fwRHk8IGfmYaR4eEe4cAyJEL66Ove/WZL7yWNL134nqLddSLwNRIsFlnnW1kK+p8Ck3viFnC0chXCXw==} - '@vue/compiler-dom@3.5.28': - resolution: {integrity: sha512-/1ZepxAb159jKR1btkefDP+J2xuWL5V3WtleRmxaT+K2Aqiek/Ab/+Ebrw2pPj0sdHO8ViAyyJWfhXXOP/+LQA==} - '@vue/compiler-dom@3.5.29': resolution: {integrity: sha512-n0G5o7R3uBVmVxjTIYcz7ovr8sy7QObFG8OQJ3xGCDNhbG60biP/P5KnyY8NLd81OuT1WJflG7N4KWYHaeeaIg==} - '@vue/compiler-sfc@3.5.28': - resolution: {integrity: sha512-6TnKMiNkd6u6VeVDhZn/07KhEZuBSn43Wd2No5zaP5s3xm8IqFTHBj84HJah4UepSUJTro5SoqqlOY22FKY96g==} - '@vue/compiler-sfc@3.5.29': resolution: {integrity: sha512-oJZhN5XJs35Gzr50E82jg2cYdZQ78wEwvRO6Y63TvLVTc+6xICzJHP1UIecdSPPYIbkautNBanDiWYa64QSFIA==} - '@vue/compiler-ssr@3.5.28': - resolution: {integrity: sha512-JCq//9w1qmC6UGLWJX7RXzrGpKkroubey/ZFqTpvEIDJEKGgntuDMqkuWiZvzTzTA5h2qZvFBFHY7fAAa9475g==} - '@vue/compiler-ssr@3.5.29': resolution: {integrity: sha512-Y/ARJZE6fpjzL5GH/phJmsFwx3g6t2KmHKHx5q+MLl2kencADKIrhH5MLF6HHpRMmlRAYBRSvv347Mepf1zVNw==} @@ -1681,9 +1659,6 @@ packages: peerDependencies: vue: 3.5.29 - '@vue/shared@3.5.28': - resolution: {integrity: sha512-cfWa1fCGBxrvaHRhvV3Is0MgmrbSCxYTXCSCau2I0a1Xw1N1pHAvkWCiXPRAqjvToILvguNyEwjevUqAuBQWvQ==} - '@vue/shared@3.5.29': resolution: {integrity: sha512-w7SR0A5zyRByL9XUkCfdLs7t9XOHUyJ67qPGQjOou3p6GvBeBW+AVjUUmlxtZ4PIYaRvE+1LmK44O4uajlZwcg==} @@ -2104,16 +2079,6 @@ packages: resolution: {integrity: sha512-jheRLVMeUKrDBjVw2O5+k4EvR4t9wtxHL+bo/LxfkxsVeuGMy3a5SEGgXdAFA4FSzTrU8rQXQIrsZ3oBq5a0pQ==} engines: {node: '>=20'} - c8@10.1.3: - resolution: {integrity: sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA==} - engines: {node: '>=18'} - hasBin: true - peerDependencies: - monocart-coverage-reports: ^2 - peerDependenciesMeta: - monocart-coverage-reports: - optional: true - cacache@15.3.0: resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} engines: {node: '>= 10'} @@ -5681,10 +5646,6 @@ packages: engines: {node: '>=6.0.0'} hasBin: true - test-exclude@7.0.2: - resolution: {integrity: sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==} - engines: {node: '>=18'} - text-hex@1.0.0: resolution: {integrity: sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==} @@ -5995,10 +5956,6 @@ packages: v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - v8-to-istanbul@9.3.0: - resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} - engines: {node: '>=10.12.0'} - varint@5.0.0: resolution: {integrity: sha512-gC13b/bWrqQoKY2EmROCZ+AR0jitc6DnDGaQ6Ls9QpKmuSgJB1eQ7H3KETtQm7qSdMWMKCmsshyCmUwMLh3OAA==} @@ -7229,8 +7186,6 @@ snapshots: dependencies: minipass: 7.1.3 - '@istanbuljs/schema@0.1.3': {} - '@jercle/yargonaut@1.1.5': dependencies: chalk: 4.1.2 @@ -7578,8 +7533,6 @@ snapshots: '@types/http-cache-semantics@4.2.0': {} - '@types/istanbul-lib-coverage@2.0.6': {} - '@types/jsdom@28.0.0': dependencies: '@types/node': 24.10.13 @@ -7840,7 +7793,7 @@ snapshots: '@vue-macros/common@3.1.2(vue@3.5.29(typescript@5.9.3))': dependencies: - '@vue/compiler-sfc': 3.5.28 + '@vue/compiler-sfc': 3.5.29 ast-kit: 2.2.0 local-pkg: 1.1.2 magic-string-ast: 1.0.3 @@ -7860,7 +7813,7 @@ snapshots: '@babel/types': 7.29.0 '@vue/babel-helper-vue-transform-on': 2.0.1 '@vue/babel-plugin-resolve-type': 2.0.1(@babel/core@7.29.0) - '@vue/shared': 3.5.28 + '@vue/shared': 3.5.29 optionalDependencies: '@babel/core': 7.29.0 transitivePeerDependencies: @@ -7873,18 +7826,10 @@ snapshots: '@babel/helper-module-imports': 7.28.6 '@babel/helper-plugin-utils': 7.28.6 '@babel/parser': 7.29.0 - '@vue/compiler-sfc': 3.5.28 + '@vue/compiler-sfc': 3.5.29 transitivePeerDependencies: - supports-color - '@vue/compiler-core@3.5.28': - dependencies: - '@babel/parser': 7.29.0 - '@vue/shared': 3.5.28 - entities: 7.0.1 - estree-walker: 2.0.2 - source-map-js: 1.2.1 - '@vue/compiler-core@3.5.29': dependencies: '@babel/parser': 7.29.0 @@ -7893,28 +7838,11 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.28': - dependencies: - '@vue/compiler-core': 3.5.28 - '@vue/shared': 3.5.28 - '@vue/compiler-dom@3.5.29': dependencies: '@vue/compiler-core': 3.5.29 '@vue/shared': 3.5.29 - '@vue/compiler-sfc@3.5.28': - dependencies: - '@babel/parser': 7.29.0 - '@vue/compiler-core': 3.5.28 - '@vue/compiler-dom': 3.5.28 - '@vue/compiler-ssr': 3.5.28 - '@vue/shared': 3.5.28 - estree-walker: 2.0.2 - magic-string: 0.30.21 - postcss: 8.5.6 - source-map-js: 1.2.1 - '@vue/compiler-sfc@3.5.29': dependencies: '@babel/parser': 7.29.0 @@ -7927,11 +7855,6 @@ snapshots: postcss: 8.5.6 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.28': - dependencies: - '@vue/compiler-dom': 3.5.28 - '@vue/shared': 3.5.28 - '@vue/compiler-ssr@3.5.29': dependencies: '@vue/compiler-dom': 3.5.29 @@ -7977,8 +7900,6 @@ snapshots: '@vue/shared': 3.5.29 vue: 3.5.29(typescript@5.9.3) - '@vue/shared@3.5.28': {} - '@vue/shared@3.5.29': {} '@vue/test-utils@2.4.6': @@ -8483,20 +8404,6 @@ snapshots: byte-counter@0.1.0: {} - c8@10.1.3: - dependencies: - '@bcoe/v8-coverage': 1.0.2 - '@istanbuljs/schema': 0.1.3 - find-up: 5.0.0 - foreground-child: 3.3.1 - istanbul-lib-coverage: 3.2.2 - istanbul-lib-report: 3.0.1 - istanbul-reports: 3.2.0 - test-exclude: 7.0.2 - v8-to-istanbul: 9.3.0 - yargs: 17.7.2 - yargs-parser: 21.1.1 - cacache@15.3.0: dependencies: '@npmcli/fs': 1.1.1 @@ -11033,7 +10940,7 @@ snapshots: md5.js@1.3.5: dependencies: - hash-base: 3.0.5 + hash-base: 3.1.2 inherits: 2.0.4 safe-buffer: 5.2.1 @@ -12623,12 +12530,6 @@ snapshots: source-map: 0.6.1 source-map-support: 0.5.21 - test-exclude@7.0.2: - dependencies: - '@istanbuljs/schema': 0.1.3 - glob: 10.5.0 - minimatch: 10.2.2 - text-hex@1.0.0: {} through2@2.0.5: @@ -12998,12 +12899,6 @@ snapshots: v8-compile-cache-lib@3.0.1: {} - v8-to-istanbul@9.3.0: - dependencies: - '@jridgewell/trace-mapping': 0.3.31 - '@types/istanbul-lib-coverage': 2.0.6 - convert-source-map: 2.0.0 - varint@5.0.0: {} varint@5.0.2: {} diff --git a/ui/web/package.json b/ui/web/package.json index 51e0d7ce..d7514e09 100644 --- a/ui/web/package.json +++ b/ui/web/package.json @@ -24,7 +24,7 @@ "lint:fix": "cross-env TIMING=1 eslint --cache --fix .", "format": "prettier --cache --write .; eslint --cache --fix .", "test": "vitest", - "coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage" }, "dependencies": { "finalhandler": "^2.1.1",