From cfad4c2bb561d595e99dfcc49e28a66b448fe8bc 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 | 8 +++++--- package.json | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c799e3..0761056 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.test-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 @@ -35,7 +37,7 @@ jobs: npm install --no-save svelte@${{ matrix.svelte }} - name: ▶️ Run validate script - run: npm run validate + run: npm run test:${{ matrix.test-runner }} - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v3 diff --git a/package.json b/package.json index b1197ca..1f3afc5 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,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 test", + "validate": "npm-run-all test:vitest:*", "contributors:add": "all-contributors add", "contributors:generate": "all-contributors generate" }, @@ -84,6 +86,7 @@ "eslint-plugin-simple-import-sort": "10.0.0", "eslint-plugin-svelte": "2.35.1", "eslint-plugin-vitest-globals": "1.4.0", + "happy-dom": "^13.3.1", "jsdom": "^22.1.0", "npm-run-all": "^4.1.5", "prettier": "3.2.4",