@cevek/screentest 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,11 +7,16 @@ screenshots. Everything ships in one npm package — no copy-paste.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm i -D @cevek/screentest playwright vitest && npx playwright install firefox
11
- # pnpm add -D @cevek/screentest playwright vitest && pnpm exec playwright install firefox
12
- # yarn add -D @cevek/screentest playwright vitest && yarn playwright install firefox
10
+ npm i -D @cevek/screentest playwright vitest
11
+ # pnpm add -D @cevek/screentest playwright vitest
12
+ # yarn add -D @cevek/screentest playwright vitest
13
13
  ```
14
14
 
15
+ No host browser install — every frame is rendered by the pinned Firefox in
16
+ the Docker daemon, so Docker is required. `snapshot.json` also records a
17
+ fingerprint of the renderer its hashes came from; when a run's renderer
18
+ differs and most screenshots changed, the log and the review UI say so.
19
+
15
20
  `playwright` and `vitest` are peer-deps — keep them in your devDependencies.
16
21
 
17
22
  ## Quick start
@@ -20,11 +25,8 @@ npm i -D @cevek/screentest playwright vitest && npx playwright install firefox
20
25
  # 1. Scaffold vitest.screentest.config.ts + tests/example.test.ts
21
26
  npx screentest init
22
27
 
23
- # 2. Start the shared Firefox daemon (one-time per machine — image builds
24
- # on first run, ~2 min; cached forever after).
25
- npx screentest serve
26
-
27
- # 3. Run.
28
+ # 2. Run. The first run builds the shared Firefox daemon image (~2 min,
29
+ # cached forever after) and starts the daemon; later runs reuse it.
28
30
  APP_URL=http://localhost:5050 npx vitest run --config vitest.screentest.config.ts
29
31
  ```
30
32
 
@@ -32,9 +34,13 @@ APP_URL=http://localhost:5050 npx vitest run --config vitest.screentest.config.t
32
34
  > to your package.json scripts so you can just `npm run screentest`.
33
35
 
34
36
  The daemon lives outside your project — one container serves every
35
- project on your machine. It listens on `ws://localhost:5180`, holds
36
- ~300MB RAM at idle, and stays up across reboots-of-your-app until you
37
- `screentest stop` it.
37
+ project on your machine. It listens on `ws://localhost:5180` and holds
38
+ ~300–450MB RAM while up. It stops itself after 3 minutes without a
39
+ connected client (`SCREENTEST_DAEMON_IDLE_SECONDS`: minimum `10`, `0` =
40
+ never, not a plain number = `180`) and the
41
+ next test run starts it again; a running test run keeps it alive.
42
+ Daemons started before 0.6 never stop on their own — after upgrading, run
43
+ `screentest stop` once.
38
44
 
39
45
  Your **tests run natively on the host** (your normal vitest + TS + path
40
46
  aliases + watch mode); only the Firefox rendering happens in the
@@ -56,7 +62,7 @@ our globalSetup; plain `vitest run` skips it entirely — no Firefox launch.
56
62
  ## Commands
57
63
 
58
64
  ```bash
59
- screentest serve # start the shared Firefox browser-server daemon
65
+ screentest serve # start the shared Firefox daemon up front (test runs start it on their own)
60
66
  screentest stop # stop it
61
67
  screentest status # is it running?
62
68
  ```