diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 3401ddd..76f43bb 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: - node-version: [16.x, 17.x] + node-version: [16.x, 17.x, 18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -46,15 +46,18 @@ jobs: node-version: ${{ matrix.node-version }} cache: pnpm - name: Install dependencies - run: | - pnpm install - pnpm add -g codecov + run: pnpm install - name: Build - run: pnpm run build + run: | + pnpm run build + pnpm -r run build - name: Lint with ESLint run: pnpm run lint - name: Test with Jest run: | pnpm run test --ci --coverage - cd admin && pnpm run test:unit && cd .. - codecov + cd admin && pnpm run test:unit --coverage && cd .. + - name: Codecov + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true diff --git a/admin/package.json b/admin/package.json index e2f49ca..b8714a1 100644 --- a/admin/package.json +++ b/admin/package.json @@ -27,6 +27,7 @@ "@vue/eslint-config-typescript": "^10.0.0", "@vue/test-utils": "^2.0.0", "@vue/tsconfig": "^0.1.3", + "c8": "^7.11.3", "eslint": "^8.17.0", "eslint-plugin-vue": "^8.7.1", "jsdom": "^19.0.0", diff --git a/admin/vite.config.ts b/admin/vite.config.ts index 5d02fc2..2803349 100644 --- a/admin/vite.config.ts +++ b/admin/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath, URL } from "url"; -import { defineConfig } from "vite"; +import { defineConfig } from "vitest/config"; import vue from "@vitejs/plugin-vue"; // https://vitejs.dev/config/ @@ -11,4 +11,9 @@ export default defineConfig({ "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, + test: { + coverage: { + reporter: ["text", "json", "html"], + }, + }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c259429..289eb2a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,6 +73,7 @@ importers: '@vue/test-utils': ^2.0.0 '@vue/tsconfig': ^0.1.3 bootstrap: 5.2.0-beta1 + c8: ^7.11.3 eslint: ^8.17.0 eslint-plugin-vue: ^8.7.1 jsdom: ^19.0.0 @@ -103,6 +104,7 @@ importers: '@vue/eslint-config-typescript': 10.0.0_o7yw3kwpe6b36wqzg4zwra6quy '@vue/test-utils': 2.0.0_vue@3.2.37 '@vue/tsconfig': 0.1.3_@types+node@16.11.39 + c8: 7.11.3 eslint: 8.17.0 eslint-plugin-vue: 8.7.1_eslint@8.17.0 jsdom: 19.0.0 @@ -111,7 +113,7 @@ importers: sass: 1.52.3 typescript: 4.7.3 vite: 2.9.12_sass@1.52.3 - vitest: 0.13.1_jsdom@19.0.0+sass@1.52.3 + vitest: 0.13.1_m5efq7gcseou5jdtbohfqjcrfq vue-tsc: 0.35.2_typescript@4.7.3 packages: @@ -2031,6 +2033,25 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} + /c8/7.11.3: + resolution: {integrity: sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==} + engines: {node: '>=10.12.0'} + hasBin: 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 + dev: true + /call-bind/1.0.2: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: @@ -3463,6 +3484,14 @@ packages: debug: optional: true + /foreground-child/2.0.0: + resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} + engines: {node: '>=8.0.0'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 3.0.7 + dev: true + /form-data/3.0.1: resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} engines: {node: '>= 6'} @@ -6801,6 +6830,15 @@ packages: source-map: 0.7.4 dev: true + /v8-to-istanbul/9.0.0: + resolution: {integrity: sha512-HcvgY/xaRm7isYmyx+lFKA4uQmfUbN0J4M0nNItvzTvH/iQ9kW5j/t4YSR+Ge323/lrgDAWJoF46tzGQHwBHFw==} + engines: {node: '>=10.12.0'} + dependencies: + '@jridgewell/trace-mapping': 0.3.13 + '@types/istanbul-lib-coverage': 2.0.4 + convert-source-map: 1.8.0 + dev: true + /validate-color/2.2.1: resolution: {integrity: sha512-1eDb1zqP6W6bbfKKl6dRXObelNoQpW7aF3BUTh2AivWuhcD0pa3ejwURWqrVsyKJMLBMlHLFcM3sj5J+dSFhbg==} dev: false @@ -6842,7 +6880,7 @@ packages: fsevents: 2.3.2 dev: true - /vitest/0.13.1_jsdom@19.0.0+sass@1.52.3: + /vitest/0.13.1_m5efq7gcseou5jdtbohfqjcrfq: resolution: {integrity: sha512-CfSBf7YFw/i8HumSUQRtZKs0aV91DC9WU8nAgIJAlawKHaFuPHQohDwOTPIFgrxySiuFYUa0Yohf9gDFfBwjxA==} engines: {node: '>=v14.16.0'} hasBin: true @@ -6863,6 +6901,7 @@ packages: dependencies: '@types/chai': 4.3.1 '@types/chai-subset': 1.3.3 + c8: 7.11.3 chai: 4.3.6 debug: 4.3.4 jsdom: 19.0.0