@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 +18 -12
- package/dist/global-setup.js +15002 -73
- package/dist/index.js +257 -82
- package/dist/runner.js +12 -7
- package/dist/templates/Dockerfile.firefox-server +1 -1
- package/dist/templates/idle-proxy.mjs +88 -0
- package/dist/templates/launch-server.mjs +36 -11
- package/dist/web/assets/index-CQ8ij0HR.js +72 -0
- package/dist/web/assets/index-DWf2oQZg.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +2 -1
- package/dist/web/assets/index-BWHB66Bb.js +0 -72
- package/dist/web/assets/index-Bi-jx470.css +0 -1
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
|
|
11
|
-
# pnpm add -D @cevek/screentest playwright vitest
|
|
12
|
-
# yarn add -D @cevek/screentest playwright vitest
|
|
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.
|
|
24
|
-
#
|
|
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
|
|
36
|
-
~
|
|
37
|
-
`
|
|
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
|
|
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
|
```
|