@cevek/screentest 0.2.0 → 0.2.1
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 +4 -0
- package/dist/index.js +13 -3
- package/dist/runner.d.ts +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,12 +40,14 @@ Existing files are not overwritten — re-run `init` safely.
|
|
|
40
40
|
screentest <doc-json-path> [--port 5174] [--no-open]
|
|
41
41
|
[--worker-url URL] [--token TOKEN]
|
|
42
42
|
```
|
|
43
|
+
|
|
43
44
|
Open the review UI on a pre-built `doc.json`. Used internally by `screentest
|
|
44
45
|
test` and `screentest review`.
|
|
45
46
|
|
|
46
47
|
```bash
|
|
47
48
|
screentest test [--host]
|
|
48
49
|
```
|
|
50
|
+
|
|
49
51
|
Default workflow: run vitest **inside Docker** (network=host), and on failure
|
|
50
52
|
auto-launch the review UI. `--host` runs vitest on the host instead (debug
|
|
51
53
|
only — bytes diverge from your CI baseline). Set `CI=1` to skip the auto-UI
|
|
@@ -54,11 +56,13 @@ launch.
|
|
|
54
56
|
```bash
|
|
55
57
|
screentest review
|
|
56
58
|
```
|
|
59
|
+
|
|
57
60
|
Skip vitest, just regenerate `doc.json` from cached actuals and open the UI.
|
|
58
61
|
|
|
59
62
|
```bash
|
|
60
63
|
screentest init
|
|
61
64
|
```
|
|
65
|
+
|
|
62
66
|
Scaffold Dockerfile + vitest config + example test (see above).
|
|
63
67
|
|
|
64
68
|
## Writing tests
|
package/dist/index.js
CHANGED
|
@@ -15265,7 +15265,12 @@ async function runVitestInDocker(snapshotFile, cacheDir) {
|
|
|
15265
15265
|
async function runOrchestrator(opts = {}) {
|
|
15266
15266
|
const paths = resolveRunnerPaths();
|
|
15267
15267
|
if (opts.reviewOnly) {
|
|
15268
|
-
const total = await generateDoc(
|
|
15268
|
+
const total = await generateDoc(
|
|
15269
|
+
paths.snapshotFile,
|
|
15270
|
+
paths.actualDir,
|
|
15271
|
+
paths.docFile,
|
|
15272
|
+
paths.cacheDir
|
|
15273
|
+
);
|
|
15269
15274
|
if (total === 0) {
|
|
15270
15275
|
process.stdout.write("Nothing to review \u2014 all snapshots match.\n");
|
|
15271
15276
|
return 0;
|
|
@@ -15292,7 +15297,12 @@ async function runOrchestrator(opts = {}) {
|
|
|
15292
15297
|
process.stderr.write(
|
|
15293
15298
|
"\n\u2192 Tests failed \u2014 launching screentest for review.\n Close the tool (Ctrl+C) when done; the original failure will still propagate.\n\n"
|
|
15294
15299
|
);
|
|
15295
|
-
const total = await generateDoc(
|
|
15300
|
+
const total = await generateDoc(
|
|
15301
|
+
paths.snapshotFile,
|
|
15302
|
+
paths.actualDir,
|
|
15303
|
+
paths.docFile,
|
|
15304
|
+
paths.cacheDir
|
|
15305
|
+
);
|
|
15296
15306
|
if (total > 0) {
|
|
15297
15307
|
const reviewCode = await run("node", [process.argv[1], paths.docFile]);
|
|
15298
15308
|
if (reviewCode !== 0 && reviewCode !== 130) {
|
|
@@ -15316,7 +15326,7 @@ import { dirname as dirname4, join as join4, resolve as resolve6 } from "path";
|
|
|
15316
15326
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
15317
15327
|
async function runInit() {
|
|
15318
15328
|
const here = dirname4(fileURLToPath2(import.meta.url));
|
|
15319
|
-
const templatesDir = [resolve6(here, "
|
|
15329
|
+
const templatesDir = [resolve6(here, "./templates"), resolve6(here, "../templates")].find((p) => existsSync2(p)) ?? resolve6(here, "./templates");
|
|
15320
15330
|
const cwd = process.cwd();
|
|
15321
15331
|
const targets = [
|
|
15322
15332
|
{ from: "Dockerfile.tests", to: "Dockerfile.tests" },
|
package/dist/runner.d.ts
CHANGED
|
@@ -15,10 +15,7 @@ export function compareSnapshot(page: Page, name: string): Promise<void>;
|
|
|
15
15
|
* Freeze `Date` inside `ctx`. `when` may be an ISO string, unix-ms number,
|
|
16
16
|
* or `Date`. Must be called BEFORE the first navigation in the context.
|
|
17
17
|
*/
|
|
18
|
-
export function freezeDate(
|
|
19
|
-
ctx: BrowserContext,
|
|
20
|
-
when: string | number | Date,
|
|
21
|
-
): Promise<void>;
|
|
18
|
+
export function freezeDate(ctx: BrowserContext, when: string | number | Date): Promise<void>;
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
* Wait for `document.fonts.ready` and every `<img>` to reach `complete`.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.1",
|
|
7
7
|
"description": "Local desktop tool for visual screenshot-test review — CLI, runner helpers, and review UI shipped as a single package.",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|