From 4731c1899de969a0ced8ff2766995692cfd7adeb Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Fri, 3 Jan 2025 19:47:06 +0900 Subject: [PATCH] setup coverage --- .github/workflows/lint-and-test.yml | 6 +++++- packages/client/package.json | 3 +-- packages/client/vite.config.ts | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 6674e419a1..de5b96b386 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -302,7 +302,11 @@ jobs: run: CI="" yarn install --frozen-lockfile - name: Run Unit Test - run: cd packages/client && yarn test -- --shard $(( ${{ strategy.job-index }} + 1 ))/${{ strategy.job-total }} + run: cd packages/client && yarn test -- --shard $(( ${{ strategy.job-index }} + 1 ))/${{ strategy.job-total }} --coverage + + - name: Report coverage + uses: davelosert/vitest-coverage-report-action@v2 + if: always() lint-knip: name: Lint unused exports with Knip diff --git a/packages/client/package.json b/packages/client/package.json index c6b8b9449d..4f3230b97a 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -11,9 +11,8 @@ "build": "NODE_OPTIONS=--max_old_space_size=8000 vite build", "docker:build": "docker build ../../ -f ../../Dockerfile-register -t ocrvs-client", "docker:run": "docker run -it --rm -p 5000:80 --name ocrvs-client ocrvs-client", - "test": "NODE_OPTIONS=--max_old_space_size=8000 vitest run --coverage --silent --dangerouslyIgnoreUnhandledErrors", + "test": "NODE_OPTIONS=--max_old_space_size=8000 vitest run --silent --dangerouslyIgnoreUnhandledErrors", "test:watch": "vitest", - "open:cov": "yarn test && opener coverage/index.html", "lint": "yarn lint:css && yarn lint:ts", "lint:css": "stylelint 'src/**/*.{ts,tsx}'", "lint:ts": "eslint --fix './src/**/*.{ts,tsx}' --max-warnings=353", diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index 661b7bc3ac..e12030c7e9 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -118,7 +118,8 @@ export default defineConfig(({ mode }) => { hookTimeout: 60000, globals: true, coverage: { - reporter: ['text', 'json', 'html'] + reporter: ['text', 'json-summary', 'json'], + reportOnFailure: true } }, server: {