From 87ed409842eaadd797269f2210f3b0f96158f62e Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 20 Aug 2023 19:55:39 +0800 Subject: [PATCH] chore(CI): fix codecov reporter (#12210) * chore(CI): update codecov/codecov-action to v3 * chore: use default test reporter * chore: use text-summary * chore: update coverage dir * chore: switch to istanbul * chore: use lcov * chore: fix open:coverage path --- .github/workflows/test.yml | 3 ++- packages/vant/package.json | 6 ++--- packages/vant/vitest.config.ts | 3 ++- pnpm-lock.yaml | 49 ++++++++++++++-------------------- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31a7310e2..ea39a185c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,9 +51,10 @@ jobs: run: pnpm run test:coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} + directory: ./packages/vant/test/coverage build: runs-on: ubuntu-latest diff --git a/packages/vant/package.json b/packages/vant/package.json index 1806c4538..9de551851 100644 --- a/packages/vant/package.json +++ b/packages/vant/package.json @@ -23,7 +23,7 @@ "test:update": "vitest run -u", "test:watch": "vitest", "test:coverage": "vitest run --coverage", - "open:coverage": "open test/coverage/index.html" + "open:coverage": "open test/coverage/lcov-report/index.html" }, "publishConfig": { "registry": "https://registry.npmjs.org/" @@ -61,14 +61,14 @@ "@vant/icons": "workspace:*", "@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue-jsx": "^3.0.0", - "@vitest/coverage-v8": "0.34.2", + "@vitest/coverage-istanbul": "0.34.1", "@vue/runtime-core": "^3.3.4", "@vue/test-utils": "^2.3.2", "diffable-html": "^5.0.0", "jsdom": "^22.1.0", "typescript": "^5.0.4", "vite": "^4.4.2", - "vitest": "^0.34.2", + "vitest": "0.34.2", "vitest-canvas-mock": "^0.3.2", "vue": "^3.3.4", "vue-router": "^4.1.6" diff --git a/packages/vant/vitest.config.ts b/packages/vant/vitest.config.ts index f20eaeb34..6949ed129 100644 --- a/packages/vant/vitest.config.ts +++ b/packages/vant/vitest.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ test: { globals: true, coverage: { + provider: 'istanbul', include: ['src/**/*.[jt]s?(x)'], exclude: [ 'src/lazyload/vue-lazyload/**', @@ -16,7 +17,7 @@ export default defineConfig({ '**/test/**', '**/lang/**', ], - reporter: ['html', 'lcov', 'text-summary'], + reporter: ['lcov', 'text-summary'], reportsDirectory: './test/coverage', }, environment: 'jsdom', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83663f86e..7ddf19201 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,9 +88,9 @@ importers: '@vitejs/plugin-vue-jsx': specifier: ^3.0.0 version: 3.0.1(vite@4.4.9)(vue@3.3.4) - '@vitest/coverage-v8': - specifier: 0.34.2 - version: 0.34.2(vitest@0.34.2) + '@vitest/coverage-istanbul': + specifier: 0.34.1 + version: 0.34.1(vitest@0.34.2) '@vue/runtime-core': specifier: ^3.3.4 version: 3.3.4 @@ -110,7 +110,7 @@ importers: specifier: ^4.4.2 version: 4.4.9(@types/node@18.17.5) vitest: - specifier: ^0.34.2 + specifier: 0.34.2 version: 0.34.2(jsdom@22.1.0) vitest-canvas-mock: specifier: ^0.3.2 @@ -627,10 +627,6 @@ packages: '@babel/helper-validator-identifier': 7.22.5 to-fast-properties: 2.0.0 - /@bcoe/v8-coverage@0.2.3: - resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - dev: true - /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -972,10 +968,6 @@ packages: '@types/node': 18.17.5 dev: true - /@types/istanbul-lib-coverage@2.0.4: - resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} - dev: true - /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: false @@ -1170,22 +1162,17 @@ packages: vite: 4.4.9(@types/node@18.17.5) vue: 3.3.4 - /@vitest/coverage-v8@0.34.2(vitest@0.34.2): - resolution: {integrity: sha512-3VuDZPeGGd1zWtc0Tdj9cHSbFc8IQ0ffnWp9MlhItOkziN6HEf219meZ9cZheg/hJXrXb+Fi2bMu7GeCAfL4yA==} + /@vitest/coverage-istanbul@0.34.1(vitest@0.34.2): + resolution: {integrity: sha512-5GprlyY2t1g6+RrssWcN/w5RnZV3qIOM0eoaSDJw3jXbHpBpMvAfTg791zXo7PIqNYs5ORUqBWXIIU0gyAfZxA==} peerDependencies: vitest: '>=0.32.0 <1' dependencies: - '@ampproject/remapping': 2.2.1 - '@bcoe/v8-coverage': 0.2.3 istanbul-lib-coverage: 3.2.0 + istanbul-lib-instrument: 6.0.0 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 4.0.1 istanbul-reports: 3.1.6 - magic-string: 0.30.2 - picocolors: 1.0.0 - std-env: 3.4.0 test-exclude: 6.0.0 - v8-to-istanbul: 9.1.0 vitest: 0.34.2(jsdom@22.1.0) transitivePeerDependencies: - supports-color @@ -2294,6 +2281,19 @@ packages: engines: {node: '>=8'} dev: true + /istanbul-lib-instrument@6.0.0: + resolution: {integrity: sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==} + engines: {node: '>=10'} + dependencies: + '@babel/core': 7.22.10 + '@babel/parser': 7.22.10 + '@istanbuljs/schema': 0.1.3 + istanbul-lib-coverage: 3.2.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + dev: true + /istanbul-lib-report@3.0.1: resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} engines: {node: '>=10'} @@ -3245,15 +3245,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - /v8-to-istanbul@9.1.0: - resolution: {integrity: sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==} - engines: {node: '>=10.12.0'} - dependencies: - '@jridgewell/trace-mapping': 0.3.19 - '@types/istanbul-lib-coverage': 2.0.4 - convert-source-map: 1.9.0 - dev: true - /vite-node@0.34.2(@types/node@18.17.5): resolution: {integrity: sha512-JtW249Zm3FB+F7pQfH56uWSdlltCo1IOkZW5oHBzeQo0iX4jtC7o1t9aILMGd9kVekXBP2lfJBEQt9rBh07ebA==} engines: {node: '>=v14.18.0'}