Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:

- uses: pnpm/action-setup@v4

# Node 22, not 20: jsdom 30 pulls in undici, which reads
# `markAsUncloneable` off node:worker_threads unconditionally. That only
# exists from Node 22.10, so on Node 20 every jsdom test worker dies at
# startup with "[vitest-pool]: Failed to start forks worker".
# Vite 8 requires ^20.19.0 || >=22.12.0.
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
Expand All @@ -33,6 +30,10 @@ jobs:
- name: Build package
run: pnpm run build

# The unit tests run in a real Chromium through Vitest browser mode.
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium

- name: Test
run: pnpm run test

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ playwright-report
coverage

storybook-static
.vitest-attachments
test/__screenshots__
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ pnpm-lock.yaml
test-results
playwright-report
coverage
.vitest-attachments
test/__screenshots__
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,17 +644,17 @@ That serves an index of every demo; each one is also reachable directly at `?dem
## Testing

```bash
pnpm test # Vitest: the state machine, in jsdom and in SSR
pnpm test # Vitest: the state machine, in Chromium and in SSR
pnpm run test:coverage
pnpm run test:e2e # Playwright: real browsers, across Chromium, Firefox and WebKit
pnpm run test:e2e # Playwright: the app, across Chromium, Firefox and WebKit
```

Both suites need a browser. Install them once with `pnpm exec playwright install chromium firefox webkit`.

The e2e suite serves the playground on port 5173. If that port is already taken — Vite's default, so it often is — set `PLAYWRIGHT_PORT` to something free, otherwise Playwright reuses whatever is already listening there and every test times out:

```bash
PLAYWRIGHT_PORT=5199 pnpm run test:e2e
```

Browsers are installed separately, once: `pnpm exec playwright install chromium firefox webkit`.

Vitest covers the engine's own logic. Playwright covers everything jsdom cannot reach: real animation interpolation through the Web Animations API, real `IntersectionObserver` for `inView`, real pointer input for `hover`/`press`, and real scrolling for `useScroll`.
Vitest runs the unit tests in a real Chromium through browser mode, so they get real animation interpolation, a real `IntersectionObserver` and real computed styles. Playwright drives the whole playground app instead, across three engines.
4 changes: 2 additions & 2 deletions e2e/diagnostics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {expect, test} from "@playwright/test"
/*
Solid 2 reports reactivity mistakes as dev-mode console diagnostics rather than
as failures — an unowned effect, a flush that is a silent no-op, a top-level
prop read that will never update. None of those surface in jsdom or in an
assertion, so this walks every playground demo in a real dev build and fails on
prop read that will never update. None of those surface as an assertion
failure, so this walks every playground demo in a real dev build and fails on
any of them.

The demo list is scraped from the playground's own index page rather than
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
"@types/node": "^22.12.0",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"@vitest/browser-playwright": "4.1.11",
"@vitest/coverage-v8": "^4.1.11",
"eslint": "^8.56.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"jsdom": "^30.0.1",
"prettier": "^3.1.1",
"solid-js": "2.0.0-rc.5",
"storybook": "^10.6.0",
Expand Down
Loading
Loading