@unotest/protocol 0.47.0 → 0.49.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/CHANGELOG.md CHANGED
@@ -1,5 +1,86 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.49.0] - 2026-10-09
4
+
5
+ ### Minor Changes
6
+
7
+ - 3531ce6: A collection can set the browser window of its scenarios.
8
+
9
+ - `viewport:` in a collection's YAML: `null` for the real browser window, `{width, height}` for an emulated size. It replaces the project's `viewport` for every scenario the collection runs; the same scenario run on its own keeps the project's window. It works with a browser profile, where `setViewport(null)` is refused.
10
+ - A wrong value is refused with what to write instead. `viewport: null` over a project `device` is refused before the first scenario starts, as in the config.
11
+ - The `setViewport(null)` refusal on a browser profile now points at the collection field.
12
+ - The viewer's collection editor keeps a hand-written `viewport:` and `prepare:` when it saves a collection.
13
+
14
+ - 970813c: A scenario file can hold several `test_*` functions, and each one is a test of its own: its own run, browser context, retry and verdict, with its own failure bundle, screenshots and console. Functions of the file are shared between its tests; state is not. `npx @unotest/web e2e <file>` plays them in order and exits 1 when any of them failed. A file with one test runs exactly as before. `e2e <file> --test <name>` plays one test, named as the function is or without its `test_` prefix. A name the file does not have is refused with exit 2 and the list of its tests.
15
+
16
+ `// @expect-fail` can mark one test: put it in the `//` comments directly above that test's `function` line, with no blank line between. A marker in the file's leading comments, set apart from the first function by a blank line, still marks every test of the file.
17
+
18
+ The MCP tool `run_test` takes `test` too. A debug session follows one test, so for a file that holds several, `run_test` without `test` starts nothing and answers with the tests and the call to make:
19
+
20
+ ```json
21
+ {
22
+ "status": "test_required",
23
+ "reason": "auth/login holds 3 tests; run_test plays one — name it in `test`.",
24
+ "tests": ["test_login_ok", "test_login_locked", "test_logout"],
25
+ "next": "run_test {name: \"auth/login\", test: \"test_login_ok\"}"
26
+ }
27
+ ```
28
+
29
+ An unknown `test` answers `status: "test_not_found"` with the same list.
30
+
31
+ A collection counts tests, not files. A file of three tests is three verdicts: its line in the `collection` output says `✗ <file> — 1 of 3 failed` and lists each test under it, and the summary counts passed, failed and skipped tests. A file that never started (bailed or busy) is still counted as one file.
32
+
33
+ The viewer shows each test on its own. A file of several tests is a node in the scenarios tree with one row per test, and the chevron opens it from the keyboard too (ArrowRight / ArrowLeft). The file's tab shows the steps of every test under its name. The file's dot and status sum its tests up: failed when one failed, skipped only when all of them skipped, failed on purpose only when every test that ran was expected to fail, otherwise passed. History shows each test's run under the file's run, and can be filtered to one test. A test's run tab shows its own steps, screenshots, console and failure, titled `file › test`, and Run again runs that test only. Home and a collection run's summary count tests, and the Home card says "tests". A link to a test's run opens that test, with its name and status in the tab.
34
+
35
+ `lint:one-test-per-file` no longer reports anything: several `test_*` in one file is now the way to write a suite of related tests.
36
+
37
+ A test that skips itself (`skip(reason)`) now shows as **skipped**, not as passed. The run tree, the history strip, the run tab (its progress bar included) and the overview draw it grey with its reason, the overview gets a "skipped" card when any test's last run skipped and no longer calls such a field "Everything is green", and a collection row counts skipped tests apart from passed ones. A run still in progress that ends in a skip turns skipped at once, without a reload. `box run` prints `(skipped)` with the reason, and its `--json` answer carries `skipReason`. Like a local `e2e`, it exits 0 on a skip.
38
+
39
+ **Migration:** `RunStatus` has a new value, `"skipped"`, and `RunMeta` and the scenario index entry carry the reason (`skipReason`, `lastSkipReason`). Code that switches over `RunStatus` exhaustively must handle the new value. Code that treated `"passed"` as "finished without failing" should accept `"skipped"` as well. The run index schema version moves to 3: the viewer discards an older index on start and rebuilds it from the runs on disk. Past skipped runs then show as skipped too.
40
+
41
+ **Migration:** the run journal has two new event kinds, `file-run:test-started` and `file-run:test-finished`, written by the run of a file with several tests. Code that switches over journal events exhaustively must handle them. Runs, manifests and `run:started` carry `test` (the function name). Its tests point at the file's run through `parentRunId`, as a collection's scenarios point at the collection's.
42
+
43
+ **Migration:** `lint:one-test-per-file` is deprecated and does nothing. A config that sets it (`"lint:one-test-per-file": "error"`) still loads; remove the entry when convenient. The rule id goes away in the next major version.
44
+
45
+ ### Patch Changes
46
+
47
+ - aac77aa: A failed step now brings its notes and the whole diff along.
48
+
49
+ - A failed statement carries the `note(label, value)` calls of its `step(...)` block: printed under the error in the `e2e` output as `note label: value`, and returned as `lastFailure.notes` (the `error` of a `run_test` reply). Secrets are masked as in the run journal. A nested step reports its own notes; a step that noted nothing reports an empty list.
50
+ - `assertEqual` shows every line of its diff. The `… N unchanged …` folding is gone from its failure message.
51
+
52
+ ## [0.48.0] - 2026-10-08
53
+
54
+ ### Minor Changes
55
+
56
+ - 2c63fd2: The viewer's status bar on a box now labels both versions — `suite 0.47.0 · box 0.48.0` — instead of a bare `v0.47.0` that read as the box's version while it was the suite's `@unotest/web`. When the suite runs an `@unotest/web` older than the lowest version the box runs suites on, the bar shows a yellow "suite too old" mark; hovering it says which version to raise in `unotest/package.json` before pushing the suite again. A viewer outside a box shows its version as before.
57
+
58
+ The box publishes its own version and that lowest supported `@unotest/web` to each environment's viewer. A box older than this change publishes neither, and the bar then labels the suite's version alone.
59
+
60
+ - a160836: A box operator can now add an environment to a project without editing the box configuration and without restarting the daemon, from a shell on the box: `docker compose exec boxd node /boxd.mjs environment add <project> <name> --target <url>`, with optional `--default-branch`, `--no-switch`, `--concurrency` and `--by`. `environment list` (the same way) shows every environment and where it came from (the configuration, added on the box, or a pull request's preview), and `environment remove` takes back one added this way — never one from the configuration, and not while a run waits or runs in it; its run history and values stay on disk. The box serves an added environment on its next sweep, or as soon as a push names it — but the box looks for new environments on a push at most once every 10 seconds, so a push refused for a missing environment in the last 10 seconds is refused again until they are up. A name the configuration also declares is refused, and if the configuration declares it later, the configuration wins.
61
+
62
+ When `env push` or `bundle push --run` names an environment the box does not have, the box now says which environments the token's project has, and the CLI lists them with the command a box operator runs to add the missing one.
63
+
64
+ - f4e2a0c: New command `bundle rm <bundle-id>`: the project token that pushes a bundle can now take it back — one pushed with the wrong project's token, or one nobody wants. The box looks for the bundle in the token's project only and answers "not found in project …" the same way whether another project holds it or none does, so a token learns nothing about other projects.
65
+
66
+ A bundle in use stays: one an environment runs, or one a waiting or running ticket needs (a queued run, or a switch on its way to it), is refused with the environments named. `--switch-to <bundle-id>` first switches the environments that run it to another bundle of the same project, the way the viewer does; the box answers as the switches start, and the same `bundle rm` removes the bundle once they have landed. An environment that follows its branch cannot be switched by hand: push a newer bundle to that branch first.
67
+
68
+ A box older than bundle removal refuses and removes nothing: update the box, then retry. `unotest-web --help` now also says that `env push` merges into the box's values and lists `--prune`.
69
+
70
+ - 57beda5: `env push` now merges an environment's values into the box instead of replacing them. Every name your files carry is set; a name the box holds that your files do not carry stays there and is listed as kept, so a value put on the box with `env set` or on the admin page survives a push. A name that moved between your `.env*` and `.secrets*` files moves on the box too and is printed as `NAME: variable → secret`. `--dry-run` says that it cannot know which names the box holds.
71
+
72
+ New flag `--prune`: also remove what the box holds and your files do not, the target override included, and list it. `UNOTEST_*` names on the box are never pruned, because a push never sends them.
73
+
74
+ A box too old to merge refuses the push with "only replaces an environment's values" and changes nothing: update the box, then retry. The CLI never falls back to a replace.
75
+
76
+ **Migration:** this changes what a published command does. A push used to remove every name its files did not carry; it now keeps them. To get the old behaviour, add `--prune`: `npx @unotest/web env push <env> --prune`. With `--json`, the answer's `status` is now `"merged"`, and it carries `set`, `kept`, `removed` and `moved`.
77
+
78
+ - 0368c9c: `bundle push --run --follow` now prints what each run printed while it goes, so a CI log says why a suite failed, not only that it did: every scenario's start and end, each failed step with where it is and its error, and the run's `log` and `note` lines. With several collections each line starts with `[collection]`; with `--json` the lines go to stderr and stdout stays the one JSON document. Each line is printed once, also when the box did not answer for a moment. Exit codes are unchanged.
79
+
80
+ The box reads the lines off the run's own journal and gives them only to the token that ordered the run, the same rule as the run's state. Before they leave the box it masks the environment's secrets again (`‹secret:NAME›`), including a value the run itself did not know to mask: a CI log of a public repository is read by everybody.
81
+
82
+ A box too old to give lines says so once — "this box does not stream run lines; the verdict and link follow" — and the follow ends as before.
83
+
3
84
  ## [0.47.0] - 2026-10-07
4
85
 
5
86
  ### Minor Changes