From 27052596c894db295a974ac5ea16fe669d322ae9 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 30 Jan 2024 17:51:38 +0800 Subject: [PATCH] Test: change test config and setup test CI workflow Chore: update deps --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ package.json | 10 +++++----- vitest.config.mjs | 9 +++++++++ 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 vitest.config.mjs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..df8e161 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test & export coverage report + +on: ["push", "pull_request", "workflow_dispatch"] + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + test: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + - name: Install dependencies + run: bun i vitest @vitest/coverage-istanbul --no-save --no-lock + - name: Run vitest + run: bun run coverage + - uses: actions/configure-pages@v4 + - uses: actions/upload-pages-artifact@v3 + with: + path: coverage + name: "." + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package.json b/package.json index eb7865b..de48bb0 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "test:ui": "vitest --ui" }, "devDependencies": { - "@vitest/coverage-v8": "^0.34.6", - "@vitest/ui": "^0.34.6", - "esbuild": "^0.19.5", - "typescript": "^5.2.2", - "vitest": "^0.34.6" + "@vitest/coverage-istanbul": "^1.2.2", + "@vitest/ui": "^1.2.2", + "esbuild": "^0.20.0", + "typescript": "^5.3.3", + "vitest": "^1.2.2" } } diff --git a/vitest.config.mjs b/vitest.config.mjs new file mode 100644 index 0000000..90c6290 --- /dev/null +++ b/vitest.config.mjs @@ -0,0 +1,9 @@ +import { defineConfig } from "vitest/config" + +export default defineConfig({ + test: { + coverage: { + provider: "istanbul", + }, + }, +}) \ No newline at end of file