From 36662a8a090ff0b77092bbfd7068d1af28d00319 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Sat, 27 Jan 2024 21:54:13 +1100 Subject: [PATCH] ci: run vitest on jsdom and happy-dom --- .github/workflows/release.yml | 12 ++++++++---- package.json | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c799e3..01fed06 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,12 +14,14 @@ jobs: main: # ignore all-contributors PRs if: ${{ !contains(github.head_ref, 'all-contributors') }} - name: Node ${{ matrix.node }}, Svelte ${{ matrix.svelte }} + name: Node ${{ matrix.node }}, Svelte ${{ matrix.svelte }}, ${{ matrix.runner }} + runs-on: ubuntu-latest strategy: matrix: node: ['16', '18', '20'] svelte: ['3', '4'] - runs-on: ubuntu-latest + test-runner: ['vitest:jsdom', 'vitest:happy-dom'] + steps: - name: ⬇️ Checkout repo uses: actions/checkout@v4 @@ -34,8 +36,10 @@ jobs: npm install --no-package-lock npm install --no-save svelte@${{ matrix.svelte }} - - name: ▶️ Run validate script - run: npm run validate + - name: ▶️ Run validate scripts + run: | + npm run lint + npm run test:${{ matrix.test-runner }} - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v3 diff --git a/package.json b/package.json index 469ce5d..3fe625a 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,10 @@ "test": "vitest run --coverage", "test:watch": "vitest", "test:update": "vitest run --update", + "test:vitest:jsdom": "vitest run --coverage --environment jsdom", + "test:vitest:happy-dom": "vitest run --coverage --environment happy-dom", "setup": "npm install && npm run validate", - "validate": "npm-run-all lint test", + "validate": "npm-run-all lint test:vitest:*", "contributors:add": "all-contributors add", "contributors:generate": "all-contributors generate" }, @@ -79,6 +81,7 @@ "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-svelte": "^2.32.0", "eslint-plugin-vitest-globals": "^1.3.1", + "happy-dom": "^13.3.1", "husky": "^8.0.3", "jsdom": "^22.1.0", "lint-staged": "^13.2.3",