@unotest/web 0.49.1 → 0.50.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.
@@ -442,13 +442,12 @@ State reads:
442
442
  value there is no polling assert: read it in a loop —
443
443
  `for (i = 0; i < 20; i = i + 1) { if (textContains(getInputValue(loc), 'x')) { break; } pause(200); // lint-ok: polling a textarea value }`
444
444
  — then assert.
445
- - Only the vocabulary above is expression language. `!` is rejected by
446
- the parser (`unotest-web lint`: `parse error — Invalid token`);
447
- `JSON.stringify` / `Date.now()` / `indexOf` and other JS globals and
448
- string methods beyond the four above are rejected by the validator
449
- with the replacement named (`use json(value)`, `use nowMs()`, `use
450
- s.includes(needle)`). Express the check as an assertion or a locator
451
- (`assertHidden`, `assertCount`, `.filter({hasText})`, `textContains`).
445
+ - A scenario is JavaScript: `!`, `JSON.stringify`, `Math.max`,
446
+ `Math.random`, `new Map()` / `new Set()`, string and array methods work
447
+ as they do in JS. `Date` and timers are left out; `unotest-web lint`
448
+ names what to use instead (`clockFreeze`, `pause(ms)`). Prefer an
449
+ assertion or a locator to a hand-written check (`assertHidden`,
450
+ `assertCount`, `.filter({hasText})`).
452
451
 
453
452
  Sandbox primitives:
454
453
  - `shell("cmd", "arg", …, options?)` — `execFile` style, no shell interpretation. Non-zero exit fails the step; pass `{allowNonZero: true}` to inspect `res.code` yourself. Wall-clock budget `{timeoutMs}` (default 120s).
@@ -573,13 +573,12 @@ State reads:
573
573
  value there is no polling assert: read it in a loop —
574
574
  `for (i = 0; i < 20; i = i + 1) { if (textContains(getInputValue(loc), 'x')) { break; } pause(200); // lint-ok: polling a textarea value }`
575
575
  — then assert.
576
- - Only the vocabulary above is expression language. `!` is rejected by
577
- the parser (`unotest-web lint`: `parse error — Invalid token`);
578
- `JSON.stringify` / `Date.now()` / `indexOf` and other JS globals and
579
- string methods beyond the four above are rejected by the validator
580
- with the replacement named (`use json(value)`, `use nowMs()`, `use
581
- s.includes(needle)`). Express the check as an assertion or a locator
582
- (`assertHidden`, `assertCount`, `.filter({hasText})`, `textContains`).
576
+ - A scenario is JavaScript: `!`, `JSON.stringify`, `Math.max`,
577
+ `Math.random`, `new Map()` / `new Set()`, string and array methods work
578
+ as they do in JS. `Date` and timers are left out; `unotest-web lint`
579
+ names what to use instead (`clockFreeze`, `pause(ms)`). Prefer an
580
+ assertion or a locator to a hand-written check (`assertHidden`,
581
+ `assertCount`, `.filter({hasText})`).
583
582
 
584
583
  Sandbox primitives:
585
584
  - `shell("cmd", "arg", …, options?)` — `execFile` style, no shell interpretation. Non-zero exit fails the step; pass `{allowNonZero: true}` to inspect `res.code` yourself. Wall-clock budget `{timeoutMs}` (default 120s).
package/CHANGELOG.md CHANGED
@@ -1,5 +1,296 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.50.0] - 2026-10-14
4
+
5
+ ### Minor Changes
6
+
7
+ - e176cb4: Scenarios are read by the new JavaScript parser and run by the new interpreter: `run`, `e2e`, `lint`, `explore_run_flow`, the viewer's editor and the bundle checks all go through it.
8
+
9
+ `evaluate` and `evaluateOnLocator` take a function as the page code: `evaluate((n) => document.querySelectorAll('li').length > n, 3)`, `evaluateOnLocator(loc, (el) => el.dataset.state)`. The page gets the function as it is written, like Playwright's `fn.toString()`, so it sees none of the scenario's variables: values go in as the arguments after it. The string form works as before, and the advice of 0.49.2 to pass the function as a quoted string no longer applies. A function anywhere else in a host call is still refused.
10
+
11
+ `apiCall(…, {base: "API_BASE_X"})` reads `API_BASE_X` from the project's environment only (`unotest/.env`, `.secrets` and the active overlay). A scenario variable of that name is no longer read as the base. When the environment has no such variable, the call is refused and says where to put it.
12
+
13
+ `run_test` checks a scenario with the same diagnostics as `lint` before the browser starts, the vocabulary checks (`validator:*`) included, and answers any error with `lint_failed` before anything runs. Info-only diagnostics never hold a run back. What `e2e` stops on is told in its own entry.
14
+
15
+ Migration:
16
+
17
+ - A scenario that assigned the base URL itself (`API_BASE_X = "https://…"`) and passed `{base: "API_BASE_X"}`: put `API_BASE_X=https://…` in `unotest/.env`, or in the overlay of the environment that needs it.
18
+ - Code that imports the engine from `@unotest/web` directly: `lintAst` takes an ESTree node (`parsed.program`); `AstExecutor` runs a parsed scenario, `run(parsed, helpers, testName, runtime, options)`; the `node` of an `ExecutionEvent` is an ESTree node; `TestRuntimeManager.register` takes `scope`, the executor's `inspectScope`. Parse with `AcornScenarioParser` from `@unotest/dsl`.
19
+ - `@unotest/web/dsl`: `createWebDslLanguageService()` also has `validateParsed(parsed, context)`, the same diagnostics for a file already parsed.
20
+ - `lint:filter-unknown-option` and `lint:role-unknown-option` are deprecated and report nothing: `validator:options` reports a key that `filter`, `locator`, `getByRole` or any other call does not read, with the sentence the run refuses it with. `lint:regex-invalid` is deprecated too: a regex that does not compile is a syntax error of the file. The three ids still load from `linter.rules`; drop them from your config, they go away in the next major.
21
+
22
+ `@unotest/dsl` gains `walk` and `childNodes`, a walk over a scenario's ESTree in source order, `scenarioFromProgram(program, source, comments, file)`, a parsed scenario from a tree another parser built (an ESLint rule's `Program`), and the host hook `pageCodeArg(name)` that names the argument a function may be handed to as page code. `@unotest/core` reads a run's last event by its shape, so it takes the events of either executor.
23
+
24
+ - f83b1c5: The step budget now fits scenarios that work with large arrays, and still stops an endless loop quickly.
25
+
26
+ - A run allows 100,000 steps by default, up from 10,000. A step is a statement or a loop pass. An endless `while` or `for` stops with `maxSteps budget (100000) exhausted` within about 20 seconds.
27
+ - A call of an arrow function with an expression body spends no step. `items.map((x) => x.id)` or `rows.filter((r) => r.ok)` over an array of up to 1,000,000 elements runs to the end. Each call still checks the test's time (`setTestTimeout`, `testTimeoutMs`, `UNOTEST_MAX_DURATION_MS`), so a long run of callbacks is cut by it.
28
+ - An arrow function with a block body spends a step per call, as any statement does.
29
+
30
+ - 7f6d3d3: Breakpoints set in the viewer no longer dirty the work tree. The store moves from `unotest/.debugger.json` to `.unotest/debugger.json` (`.unotest/debugger-mobile.json` for mobile). `init` already lists `.unotest/` in `.gitignore`. The viewer, the CLI (`e2e --debug`) and the MCP `run_test` read and write the new file.
31
+
32
+ Migration: nothing to do by hand. The first viewer start or debug run moves an existing `unotest/.debugger.json` to the new place, keeping its breakpoints. If both files exist, the new one is used and the old one is left alone. Git then shows `unotest/.debugger.json` as deleted: commit the deletion.
33
+
34
+ `@unotest/protocol`: `debuggerFileFor(suffix)` returns the new path; `legacyDebuggerFileFor(suffix)` names the old one and `LOCAL_STATE_DIR` is `.unotest`. `@unotest/core`: `debuggerFile(projectRoot, suffix)` returns the store's absolute path and performs the move.
35
+
36
+ - 5f1e0a9: A test that spends its step or memory budget now ends as `errored ‼`, not `failed ✗`. A wrong value in an options slot now stops the run before the browser starts.
37
+
38
+ - `maxSteps budget (100000) exhausted` and `the run holds … MB more than at its start` count what the scenario itself did: its statements, the values it keeps. No slow application spends them, so the test is broken, not the application. They now count as errored in the `e2e` and `collection` summary. A spent time budget (`testTimeoutMs`, `setTestTimeout`, `UNOTEST_MAX_DURATION_MS`) is still `failed ✗`: a slow application spends it too. The exit code is 1 either way.
39
+ - A call that gives a non-object where options go, such as `assertUrl('/', 'oops')`, is now reported as `[validator:options]` instead of `[validator:arg-kind]`, and the run stops before it starts with `run stopped`, as it does for an unknown option key. Before, the run started and the test ended as errored on that line, after the steps before it had run. Other `arg-kind` findings still do not stop the run.
40
+
41
+ Migration: a CI step that counted a spent step budget as a failure now sees it as an error. A lint config that set the level of `validator:arg-kind` to quiet this finding should set `validator:options` instead.
42
+
43
+ `@unotest/dsl/executor`: `BudgetExhaustedError` is now an abstract base, and `instanceof` it still finds every spent budget. A spent step budget throws `StepBudgetExhaustedError`, a spent time budget throws `DurationBudgetExhaustedError`, which is the only one marked as a failed check (`isCheckFailure`). `MemoryBudgetExhaustedError` is no longer a failed check either.
44
+
45
+ - 9413745: `e2e` stops before the browser on the scenario errors the run would refuse anyway. It still prints every diagnostic of the pre-run lint, as `lint` does, and now refuses to start on a `validator:*` error the run cannot get past — an unknown function, JavaScript outside the scenario language, an option the call does not read (`click(loc, {forse: true})`), a `const` assigned again, a member a value does not have, a scenario variable read inside the function handed to `evaluate` (the page has no such variable) — on page code for `evaluate` built from scenario values (a `${…}` in it, or a string put together at run time), and on a rule the project raised to `error` in `linter.rules`. The two page-code checks — values spliced into page code, scenario variables read inside the function handed to the page — cover the helpers of `_helpers/` the run loads as well, and the line printed names the helper file; any other finding in a helper is left to `lint`. The refusal exits 1 after the line `run stopped: N error(s)`; no browser starts and nothing is written under `unotest/.runs/`. Errors of shape — `validator:arity`, `validator:step-shape`, a call outside `step(...)` — and `lint:*` errors at their default severity are printed and the run goes on, as before.
46
+
47
+ Migration: a suite with one of those errors used to start, run the steps before it and fail there; its CI now goes red before the run, without those side effects. Run `npx @unotest/web lint` to see the same list and fix the call. Setting the rule to `warn` in `linter.rules` lets the run start again, and it stops with an error where it did before.
48
+
49
+ `@unotest/dsl`: a `ScenarioDiagnostic` the run would refuse as well carries `failsRun: true`.
50
+
51
+ - eaa17ad: Four messages a new user meets on a first run now say what to do.
52
+
53
+ - A test's result line in the `e2e` and `collection` output starts with the run's own word: `failed ✗ test: …` for a failed check, `errored ‼ test: …` for a script that could not do what it was asked. Before, both started with `error`, and only the sign told them apart. The line still goes to stderr. A CI step that searched the output for `error ✗` or `error ‼` should search for `failed ✗` / `errored ‼` instead.
54
+ - `{timeout}` and `{timeoutMs}` are one option: `lint` now refuses a call that gives both, with the sentence the run already gave (`assertUrl: {timeout} and {timeoutMs} are the same option — give one of them.`), and `e2e` stops on it before the browser starts. A list of the keys a function takes names one key per option: `Usage: {timeoutMs?}` for `assertUrl('/', 'oops')`, where it used to suggest both keys with made-up values, a line that was then refused when copied.
55
+ - A run that spends its step budget says where and why: `maxSteps budget (100000) exhausted at unotest/e2e/first/endless.js:5 — the test ran 100000 statements and loop passes: a loop or a callback that never ends? The limit is fixed — make the loop end, or do less in one test (filter earlier, split the test).` A spent time budget names the setting that raises it: `testTimeoutMs` in `unotest.config`, `UNOTEST_MAX_DURATION_MS`, or `setTestTimeout(ms)` in the test.
56
+ - An unknown function that is a typo of one the scenario language has is named: `Unknown function: clik — did you mean click?`, in `lint` and in a run alike. A name more than two edits from any function gets no guess.
57
+
58
+ `@unotest/dsl`: an options argument kind may carry `same` (an older key to the name it stands for); `validator:options` refuses a call that gives both, and `optionKeysLabel`, `sameOptionPair` and `sameOptionMessage` are exported for a vocab's own guards. `BudgetExhaustedError` carries `at` (file and line) for a spent step budget, and its message says what to do.
59
+
60
+ - c5442cf: `collection`, `box runs` and `box run` now use the same signs and words as `e2e` and the viewer: `✗ failed` for a check that did not hold, `‼ errored` for a script that could not do what it was asked, and `■ aborted` for a run that was stopped.
61
+
62
+ What changes in the output. Update a CI step that searches the log for any of these:
63
+
64
+ - An errored scenario or test in a collection prints `‼ scenario: … — errored` and is labelled `errored`. Before, it printed `✗ … — failed`.
65
+ - A stopped or interrupted scenario prints `■ … — aborted` / `■ … — interrupted`. Before, it was marked `‼`.
66
+ - The collection summary names the errored part of the failures: `pass=1, fail=3 (2 errored)`. `fail=` itself has not changed: it still counts every scenario that did not hold, errored ones included, so a check for `fail=0` reads the run as before. A collection with errored scenarios still fails and exits 1.
67
+ - In a file of several tests, the file's line counts each kind, for example `✗ scenario: shop (900ms) — 1 of 3 failed, 1 errored`. If none of its tests failed, the line starts with `‼` and reads `1 of 3 errored`.
68
+ - `box runs` and `box runs --latest` show `‼ errored`, `■ aborted` and `✓ failed on purpose` (a test marked `@expect-fail`) in their status column. Before, all three were shown as `✗` with the stored status. `box run` names the same word in brackets, for example `‼ checkout (errored)`.
69
+
70
+ `box run --follow` still prints an errored scenario as `✗ … — failed` until the box itself reports errored runs.
71
+
72
+ - 5c9d2d5: `validator:if-shape` checks the condition of `while`, `do...while`, `for` and the `?:` operator as it checks `if`: a condition known to be a number, a string or an array (`while ("x")`, `for (;5;)`) is a lint error. The message names the statement: `while() condition must be a boolean expression`. `run_test` does not start a scenario with a lint error, so such a scenario no longer runs there. What to do: write the comparison you mean, `while (items.length > 0)`.
73
+ - 7d6d1aa: Editor typings now match the scenario language exactly. The `unotest/jsconfig.json` that `init` writes sets `noLib: true` and adds a new declaration file, `types/unotest-lib.d.ts`: the scenario library (`Math`, `JSON`, `Object`, `Map`, `Set`, string, number and array methods) cut from TypeScript's own declarations. The editor completes what a scenario has and no longer offers `Date`, `setTimeout`, `document` or `s.big()`, which lint refuses. What to do: an existing project runs `npx @unotest/web types` once. A jsconfig written by an earlier `init` and left untouched is brought up to date; `lint` and runs print a one-line reminder until then. A jsconfig you edited by hand is never rewritten: the reminder says to set `"noLib": true` and add `./node_modules/@unotest/web/types/unotest-lib.d.ts` to `include`.
74
+ - 70ef8a0: A DSL function no longer drops an extra argument (#428). Before, the run ignored it: `assertEqual(1 + 1, 2, 'math works')` was flagged by `lint` (`validator:arity`), yet `e2e` ran the test and passed it; a call whose arguments come from a spread, such as `note('n', ...values)`, was not flagged at all. Either call now fails its step before the function runs: `assertEqual() takes at most 2 arguments, got 3 — remove the extra argument`, and the test ends errored. Functions that take any number of arguments (`log`, `evaluate`, `shell`, `dbQuery` and the like) are unchanged.
75
+
76
+ Migration: a suite whose CI runs `e2e` without `lint`, and that has a call with an extra argument, passed before and now goes red on that test. Run `npx @unotest/web lint` — every such call written out is listed under `validator:arity` — and remove the extra argument, or pass the values as one array.
77
+
78
+ `goBack`, `goForward`, `selectOption` and `dragAndDrop` take their options in lint too. The calls always read `{timeoutMs}` and the browser's own keys, as the DSL reference says, but lint called `goBack({timeoutMs: 5000})` an extra argument. Lint now accepts these options and names a misspelled key, as it does for `click`.
79
+
80
+ A DSL function called with a huge spread now fails with a message that names it. `log(...rows)` with some 200,000 elements used to end the test with `Maximum call stack size exceeded` and no function named. One call of a DSL function now takes at most 10,000 arguments: `log() was given 200000 arguments; a DSL function takes at most 10000 — pass an array`. What to do: pass the array itself, `log(rows)`.
81
+
82
+ - d3c62fa: A scenario can no longer reach the library's internals through `Math`, `JSON`, `Object` or `Array`. `Object.keys(Math)`, `Object.entries(Math)`, `Object.assign(Math, …)`, `Object.hasOwn(JSON, …)`, `Array.from(Math)` and `for (k in Math)` are refused with "got a namespace such as Math". A DSL function refuses one among its arguments (`note('m', Math)`). `JSON.stringify(Math)` writes `{}`, as JavaScript does. Before, a write through `Object.entries(Math)` broke `Math` for every later test of the same process. `typeof Math` is still `"object"`, and every member works as before.
83
+ - 1c17d91: A scenario can no longer take the runner down by building a huge string or array. `'x'.repeat(1e9)`, `padStart(1e9)` or `Array.from({ length: 1e9 })` used to exhaust the runner's memory and end the run with no reason given; a string doubled in a loop (`s = s + s`) did the same in about thirty passes. Strings are now bounded at 10,000,000 characters and arrays at 1,000,000 elements: `repeat`, `padStart` / `padEnd`, `replace` / `replaceAll`, `join`, `String(array)`, `JSON.stringify`, `String.raw`, `Array.from`, `concat`, `flat`, `flatMap`, `+`, `+=` and template literals fail with a `RangeError` that names the call, the size it asked for and the bound, before the value is made. For a larger payload, use a file fixture.
84
+
85
+ This is a behaviour change: a scenario that built a string of more than 10,000,000 characters, which used to pass while it fit in memory, now fails with that `RangeError`.
86
+
87
+ A spread now reaches the array bound: `[...items]`, `push(...items)`, `Math.max(...items)` or a scenario function called with `...items` used to fail at about 120,000 elements with `Maximum call stack size exceeded`; a spread of up to 1,000,000 elements now works.
88
+
89
+ - 99678b8: Every DSL call that takes an options object checks its keys. A key the call does not read is refused, by `lint` before the run and by the call itself during it, with the same sentence: `click: unknown option "forse" — supported: {timeout?, force?, …}.` The value of a known key is checked too: `{timeout: "soon"}` is a lint error.
90
+
91
+ Migration: a few keys used to be accepted and silently dropped, and are now refused.
92
+
93
+ - `doubleClick` no longer takes `button` or `clickCount`: they never reached the browser.
94
+ - `waitForText` no longer takes `first`: the wait always looks at the first visible match.
95
+ - `waitForNavigation` no longer takes `waitUntil`: it waits for the navigation the page starts.
96
+ - `scrollIntoView` takes no options object: it never read one.
97
+
98
+ Remove the key; the call behaves as it did. The other calls refuse only keys they never read: `getByText`, `getByLabel`, `getByPlaceholder`, `getByAltText`, `getByTitle` (they read `exact`), `screenshot` (`fullPage`), `setCookie` (`domain`, `path`, `expires`, `httpOnly`, `secure`, `sameSite`) and `apiCall` (`base`).
99
+
100
+ In the scenario type declarations an options parameter is `Record<string, unknown>` instead of `any`.
101
+
102
+ `note(label)` without a value is an arity error in `lint`.
103
+
104
+ `@unotest/dsl` gains `validateScenario`, the validator over the new scenario parser. It reports the old rules with their ids and texts, and adds `out-of-language` (JavaScript the scenario language leaves out, with what to write instead), `implicit-declaration` (an info: a variable assigned without `let` / `const`), `evaluate-interpolation` (`${…}` in code handed to the page) and `template-escape-changed` (a backslash escape in a backtick template now reads as in JavaScript). An options slot in a function contract is the new argument kind `{options: {key: kind}}`.
105
+
106
+ - 1e15351: Page code built from scenario values is refused wherever the run would load it, not only in the test's own file. `e2e`, `run_test` and `explore_run_flow` now check the helpers of `_helpers/` for it before anything runs: `evaluate('1 + ' + t)` or `evaluate(() => document.title + t)` inside a helper stops the run, and the diagnostic carries the helper's `file` (the CLI prints `unotest/e2e/_helpers/h.js:2:10`). `explore_run_flow` runs the same pre-run lint as `run_test` before it replays a flow, and answers with the list of errors instead of replaying. Only the page-code rules are checked in helpers: a helper's other findings stay with `lint`, so a run that passes today does not stop on them.
107
+
108
+ `evaluateInServiceWorker` takes a function as well as a string, as `evaluate` does — `evaluateInServiceWorker((t) => chrome.storage.local.set({t}), 'dark')` — under the same page-code rules.
109
+
110
+ What to do if a run now stops on a helper: pass the value to the page as an argument, `evaluate((v) => 1 + v, t)`, and keep the code itself fixed text or a function that reads only its own parameters. `npx @unotest/web lint` shows the same lines.
111
+
112
+ `@unotest/dsl`: a `ScenarioDiagnostic` whose finding the run refuses in any file it loads, helpers included, carries `harmsRun: true`.
113
+
114
+ - 7eed455: `validator:evaluate-interpolation` now judges the code handed to `evaluate` / `evaluateOnLocator` / `evaluateInServiceWorker` by where it comes from, not only by a `${...}` written in the call. A string built at run time (`evaluate('1 + ' + x)`, a variable that is ever given text read off the page, an external variable) is refused by `lint` and before the run starts, because a value in it would become code of the page. Text the source spells out passes: a string literal, a template without `${...}`, `+` of those, or a variable every assignment of which is one — declared with `let` or `const`, or assigned without a declaration (`` js = `...`; evaluate(js) ``), or the variable of a `for…of` over an array literal of such texts (`for (const js of ['document.title', 'document.URL']) evaluate(js)`). What to do with a refused call: write the page code as a function and pass values as arguments, `evaluate((n) => n + 1, x)`.
115
+ - 91ede7d: `Math.random()` is part of the scenario language: each call draws a new number in [0, 1), as in JavaScript. A run that uses it is no longer the same run twice; for fresh test data `randomWord(n)` and `randomEmail()` still read better.
116
+
117
+ `new Map(entries?)` and `new Set(items?)` are part of the scenario language, with their members as in JavaScript: `get`, `set`, `add`, `has`, `delete`, `clear`, `size` and `forEach`. `keys()`, `values()` and `entries()` return arrays, so `m.keys().map(...)` works directly; `for...of`, a spread and `Array.from` iterate a Map or a Set as in JavaScript. In `note`, `log` and the viewer's Vars a Map reads as `Map(1) {"a" => 1}` instead of `{}`. The validator names a member a Map or a Set does not have (`m.length` is `m.size`), and the editor typings declare the array results. `new` stays out of the language for anything else, including a `Map` the scenario declares itself; `WeakMap`, `WeakSet` and `WeakRef` remain refused.
118
+
119
+ - 303b935: A test that keeps too much in memory now ends as errored with the reason, instead of taking the runner down.
120
+
121
+ - A run may grow the heap by at most 512 MB over the heap at its start, and never by more than half the heap's limit. Past it the test ends as `errored ‼` with `the run holds 530 MB more than at its start; the limit is 512 MB`, followed by what to do: keep fewer large values alive at once, or use a file fixture or read the data in parts. This holds for `e2e`, `run_test` and `explore_run_flow`. Before, a statement such as `Array.from({length: 1000000}).map(() => 'y'.repeat(10000))` filled the runner's memory until the process was killed, with no word about why. On a box, the run's container was killed.
122
+ - The size is what the run holds, not what it has dropped: past the limit, the runner collects garbage and reads the heap again, and the test ends only if it still holds more. A run that makes a gigabyte of strings and keeps only their lengths passes. The start of each run is measured after a collection as well.
123
+ - The memory is checked together with the test's time: on every statement, loop pass and callback. Like the other budgets, it cannot be caught with `try`/`catch`. Each run is measured from its own start, so an explore session does not carry memory over from one flow to the next.
124
+ - `split`, `match` with a global pattern, `matchAll`, `Array.from`, `Object.keys`, `Object.values` and `Object.entries` of a string, and the arrays `JSON.parse` makes now respect the 1,000,000-element array bound. Past it they fail with a `RangeError` such as `.split() would make an array of more than 1000000 elements; the limit is 1000000`. Before, `'ab'.repeat(5000000).split('')` made an array of 10,000,000 elements, `Object.entries` of a 10,000,000-character string took 1.5 GB in one call, `Array.from` of one made an array of 10,000,000, and `JSON.parse` of a text within the string bound made an array of 5,000,000. `Array.from` makes one element per character of a string, an emoji included. `JSON.parse` checks its arrays after parsing, so it still takes text nested as deeply as before.
125
+
126
+ Migration: a scenario that split or matched a text into more than 1,000,000 parts, or parsed JSON with an array of more than 1,000,000 elements, now fails. Pass `split` a limit, or read the text or the data in parts.
127
+
128
+ `@unotest/dsl/executor`: `RunOptions` gains an optional `memory`, a `MemoryProbe` (`heapUsedBytes()`, `heapLimitBytes()`, and an optional `collectGarbage()`; without it the size is read as it stands and the message says it may count garbage). Without it, a run's memory is not read. The package also exports `MemoryBudgetExhaustedError` and `MAX_RUN_HEAP_GROWTH_BYTES`.
129
+
130
+ - ca28445: A scenario no longer reads the runner's own credentials, and a `shell()` step's process no longer inherits them. A bare identifier still resolves against the whole environment, so `BASE_URL` or a token a CI job exports reads as before. The names kept to the runner: `UNOTEST_JUDGE_TOKEN`, `UNOTEST_JUDGE_ACCESS_TOKEN`, `UNOTEST_CLOUD_TOKEN`, `UNOTEST_BOX_TOKEN`, `UNOTEST_BOX_READ_TOKEN`, the grounder's `UNOTEST_GROUNDER_REMOTE_TOKEN`, `_PROVIDER_KEY`, `_PICKER_KEY`, `_EMBED_KEY`, `_SHARED_TOKEN`, `_METRICS_TOKEN` and `_REVOCATIONS_TOKEN`, and the judge provider's API key (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `GEMINI_API_KEY`), the last only while `UNOTEST_JUDGE_MODE=local` and only for the active provider.
131
+
132
+ Reading one is refused with whose it is, for example `ANTHROPIC_API_KEY is the judge's credential (UNOTEST_JUDGE_MODE=local) on this runner, not a scenario variable`, rather than "not found". The check a run makes before the browser starts, `{{NAME}}` in `explore_step` and `sandbox.exportSecrets` give the same sentence.
133
+
134
+ `@unotest/protocol` exports `JUDGE_API_KEY_ENV` and `judgeSecretEnvNames(env)`. `@unotest/grounder-client` exports `GROUNDER_SECRET_ENV` and `GROUNDER_SECRET_ENV_NAMES`.
135
+
136
+ Migration:
137
+
138
+ - A scenario or a `shell()` command that read one of these names on purpose: give the value its own name in `unotest/.secrets` (`APP_ANTHROPIC_API_KEY=…`) and read that. With a remote judge, or a judge on another provider, a vendor API key is the application's and reads as before.
139
+
140
+ - 2d1a70b: A run is now counted `failed` or `errored` by the class of its error, not by the words in its message. A failed check is `failed`; a script that could not do what it was asked is `errored`. What changes in the count:
141
+
142
+ - An action on a locator that matches several elements is `failed`, and the message names the locator as the scenario wrote it: `click: getByRole("button", {name: "Edit"}) matches 30 elements, and an action needs exactly one. Narrow it to the one you mean: a name, a parent locator, or .first() / .nth(i).` It used to be `errored`, with the browser library's "strict mode violation" text.
143
+ - A test that runs out of its budget (`setTestTimeout`, `testTimeoutMs`, `UNOTEST_MAX_DURATION_MS`) is `failed`. It used to be `errored`.
144
+ - A stale or unresolvable element reference is `failed`. It used to be `errored`.
145
+ - A shell command that runs out of time is `errored`, like any other shell command that does not finish. It used to be `failed`.
146
+ - A wrong call of the script (a missing file, a path outside the project, two names of one option) stays `errored`, and `// @expect-fail` does not excuse it: the marker expects a failed check.
147
+
148
+ `@unotest/dsl`: `ExecutionError.checkFailure` carries the error's kind across the executor, with the `CheckFailure` interface and the `isCheckFailure` guard for error classes of a host vocabulary.
149
+
150
+ - accf0d6: The viewer now shows an errored run as errored, the way the CLI counts it, instead of as failed. A failed check is `failed`; a script that could not do what it was asked — a wrong call, a browser that went away, a command that did not finish — is `errored`.
151
+
152
+ - Home has an `errored` card and legend entry. An errored tile carries the `‼` sign as well as its own colour. The headline uses the CLI's words: `1 failed · 1 errored.`
153
+ - Failing now, the run history, the run's tab and the Runs badge draw an errored test with `‼`. It still counts as broken now.
154
+ - On an errored run's tab, the step it broke on, its block, the progress bar and the error card take the errored sign and colour.
155
+ - A run that failed on purpose is purple in the run history too, as it is on Home: one run, one colour everywhere.
156
+ - The red of a failed check is darker in light theme and lighter in dark theme, so its text badge meets WCAG AA contrast.
157
+ - A file of several tests reads as errored only when none of its tests failed a check.
158
+
159
+ `@unotest/protocol`: `run:finished`, `file-run:test-finished` and `collection-run:scenario-finished` carry `errored: true`, and `RunMeta` carries `errored`. The outcome stays `failed`, so a reader that predates the field still sees a failed run. The run index schema is now version 5 (`lastErrored`, `recentErrored`). An older index is rebuilt on first read.
160
+
161
+ - decec09: The viewer reads a scenario the way the engine runs it. Its step tree shows `try` / `catch` / `finally` and `switch` as control rows: the header row carries its own status, and `catch (e)`, `finally` and each `case …:` open a branch beneath it, as `else` does for `if`. A bare `{ … }` block, an empty statement and a nested function are no rows of their own; their statements are. A body written without braces (`if (i > 7) break;`) belongs to its header's row, as the run reports it, and a `do … while` row shows its condition. A finished step whose `else`, `catch` or other `case` never ran reads passed, not running. `await step(…)` in an `async` test is a step block like any other. A literal step tag (`{tag: 'q1'}`) shows as its text before the run; an expression tag shows as written. Scenario discovery and helper completion in the viewer read the full language: a test file with top-level `const`, `async` tests, `try` or `switch` lists its tests, and a helper with a default, rest or destructured parameter offers one placeholder per parameter.
162
+
163
+ The editor typings declare `teardown(label, body)`, `waitUntil(condition, options?)`, `Array.prototype.sortBy` and the array methods the scenario language has beyond ES2022 (`findLast`, `findLastIndex`, `toReversed`, `toSorted`, `toSpliced`, `with`), so the editor no longer marks them unknown.
164
+
165
+ The ESLint rule `@unotest/dsl` checks the tree ESLint already parsed instead of parsing the file a second time, with the same diagnostics as `unotest-web lint`. A file that defines one function twice gets the parse diagnostic `lint` prints rather than an exception out of ESLint, and the rule runs under ESLint's `RuleTester`. `@unotest/web/dsl` exports what such a frontend needs: `scenarioFromProgram`, `ProgramComment`, `ScenarioSyntaxError` and `parseDiagnostic(error)`, the diagnostic `lint` reports for a file that does not parse.
166
+
167
+ The function handed to `evaluate` / `evaluateOnLocator` is code of the page, and `lint` no longer checks it as the scenario: `document`, `getComputedStyle(el)`, `new RegExp(re)` or an upper-case page global in it are not refused. What `lint` does check there is new, `validator:page-code-closure` (error): a variable of the scenario read inside that function, which the page does not see — pass it as an argument, `evaluate((n) => …, n)`.
168
+
169
+ ### Patch Changes
170
+
171
+ - d858002: A failed `assertText`, `assertTexts`, `assertAttribute` or `assertValue` now writes the characters a reader cannot see as escapes in its message. A page that joins an amount with a non-breaking space used to fail with `expected equal "S/ 500", got "S/ 500"` — two lines that look the same. The message now reads `got "S/\u00A0500"`. The same goes for other unusual spaces and for zero-width and format characters (`\u200B`, `\uFEFF`, a soft hyphen). The comparison itself is unchanged.
172
+ - bbbc482: A debug run that paused on a failed check and was continued now ends as `1 failed`, as the check did. It used to end as `1 errored`, the count reserved for a run that broke rather than a check that did not hold.
173
+ - 7cf7554: The type declarations of `@unotest/web/config` are the same in every build. Union members such as the retry reasons (`"transient" | "network" | "crash"`) are printed in the order the schema declares them; before, a rebuild of the same version could print them in another order. The types themselves do not change.
174
+ - e1a0db1: A DSL warning is now an ESLint warning, not an error. `@unotest/dsl` reports the engine's errors, and the new rule `@unotest/dsl-warning` reports its warnings. `recommended()` sets them to `error` and `warn`. A suite with only warnings (`lint:pause-explicit`, say) no longer fails `npx eslint`. The file is still validated once.
175
+
176
+ Migration: with `recommended()` there is nothing to do. A config that names `@unotest/dsl` by hand reports errors only until it adds `"@unotest/dsl-warning": "warn"`. To keep warnings failing the build, set `"@unotest/dsl-warning": "error"`.
177
+
178
+ - ab05878: A run that refuses a `function*` declared inside a `step(...)` names that step in its failure line (`in step "…"`), as it does for any other failed statement. The refusal is now a failed statement of its own, at the declaration: the viewer lists it under the step, and a debug run pauses on it. It still comes before anything else in the block runs.
179
+ - c35ccb6: `lint` reports a function that a scenario and a helper in `_helpers/` both define, with the same words the run refuses it in: `✗ error [load] duplicate function "name" — first defined at …, also at …`. Before, `lint` passed such a scenario and only the run stopped on it. A clash between two helpers is reported at each of the two helper files.
180
+ - ba95590: Large variables no longer slow a run down. The live view of a run (the viewer's Vars, `inspect_runtime`) shows the first 4 KB of each variable and is refreshed every 50 ms. It used to read each value whole and then cut it, so a loop that kept adding to an array paid for everything the array held, again and again. A scenario that kept 200 strings of 1 MB took more than a minute instead of under a second, and one that kept 1 GB ran out of time instead of stopping at the memory limit. Each refresh now reads only what it shows, so a value of any size costs the same.
181
+
182
+ A run paused by the debugger with a variable that is `undefined` sent its pause without any variables. It now sends the others and leaves that one out, as the live view does.
183
+
184
+ `@unotest/core` exports `cappedJson(value, minBytes, replacer?)`: the text of `JSON.stringify`, or a prefix of it longer than `minBytes` bytes, read only that far. It also exports `serializeVars`. The `stringifyVar` hook of `buildRuntimeInspection` gets the byte count as its second argument, and may return `undefined` for a variable with no JSON. `snapshotOf` in `@unotest/dsl/value` takes an optional `maxNodes`, the most values it reads. It is unlimited by default.
185
+
186
+ - 385cbe0: After a failed run, the viewer's Vars tab shows the variables in scope where the run failed, including the `let` and `const` declared inside the failing `step(...)`. Before, it showed the scope after the step's block had closed: an empty tab when the run ended there, the scope the run went on to after Continue from a failure pause, or a teardown's own scope once the rollback blocks had run.
187
+
188
+ `@unotest/dsl`: `ScenarioInterpreter.inspectScope()` answers for a finished failed run with the scope taken at its failure, and for the entry's run again once `runTeardowns` is over.
189
+
190
+ - ff7bdae: Viewer fixes:
191
+
192
+ - **Run again tab.** After Run again on an errored or `// @expect-fail` test, the new run's tab now shows the same mark as its history row (`‼` for errored, the expected colour for an expected failure). Before, it showed a plain red dot until the page was reloaded.
193
+ - **History after overlapping loads.** The run history no longer goes back to an older list when an earlier refresh answers after a later one.
194
+ - **One-line callbacks.** In the Steps and Trace tabs, a callback written on one line, such as `items.forEach((k) => { seen.add(k); });`, now opens into rows that show its own statement (`seen.add(k);`). Before, each row repeated the whole line. Runs recorded by earlier versions still show the whole line in the Trace tab.
195
+ - **Error card badge.** The badge on a failed step now says what kind of failure it is, in the words the CLI uses: `failed check` when a check did not hold, `script error` when the script could not do what it was asked. The error's class name, such as `NullMemberError`, now appears on hover. Before, the badge showed only the class name.
196
+
197
+ `@unotest/protocol`: `step:started` gains optional `endLine` and `endCol`, the end of the statement. `endCol` is the 1-based column just past its last character.
198
+
199
+ - fe8540b: Viewer: a statement that hands a function to a call, such as `xs.forEach((x) => { ... })`, now opens into the statements of that function, as an `if` does. Each of them shows its status and notes and takes a breakpoint. Page code passed to `evaluate` / `evaluateOnLocator` stays closed: the page runs it, not the scenario. The DSL vocabulary entries carry `pageCodeArg` for that, and `@unotest/dsl` exports `calleeName`.
200
+ - 9b834c7: The viewer's history counts a collection the way the CLI does. Errored tests are part of failed and marked apart, tests that failed on purpose are not failed at all: a run the CLI reports as `pass=1, fail=2 (1 errored), expected=1` reads `1 ✓ 2 ✗ (1 ‼)` in the row with the failed-on-purpose count beside its purple dot, and `1 passed, 2 failed (1 errored), 1 failed on purpose` to a screen reader. An `@expect-fail` test that passed counts as failed, as everywhere else.
201
+
202
+ The viewer's Vars tab shows a `Map` and a `Set` as what they are: the type with its size, and a Map's entries as key → value or a Set's values, one per row. They used to arrive as a quoted string of type `string`. A Map or a Set inside an object, an array or another Map is drawn the same way, at any depth. What an agent reads through the tools is unchanged: `inspect_runtime`, `step` and `run_test` print each variable byte for byte as before. The run's `runtime.json` and the `paused` events of its journal carry a Map or a Set in the tagged form below. Two values read differently there than before: a locator inside a Map or a Set prints as its description (`<Locator …>`), and a value cut at the 4 KB cap is cut in its tagged form.
203
+
204
+ `@unotest/dsl` gains the entry `@unotest/dsl/value`: a scenario value in the form a run snapshot carries it (`snapshotOf`; a Map or a Set as `{"$type": "Map", "entries": […]}` / `{"$type": "Set", "values": […]}`, a scenario object with its own `$type` key wrapped as `{"$type": "Object", "value": {…}}`), as one line of text (`snapshotText`), and in the form written before the tags (`untagged`). The entry carries no parser.
205
+
206
+ - 0ceae40: Viewer: a run tab opened as the run starts (Run, Run again, R in the tree) now shows how it ended without a reload. The failed step opens with its error card, and Vars shows the final values instead of "no vars in scope yet". A step you open or close by hand keeps your choice.
207
+ - Updated dependencies [e176cb4]
208
+ - Updated dependencies [f83b1c5]
209
+ - Updated dependencies [7f6d3d3]
210
+ - Updated dependencies [5f1e0a9]
211
+ - Updated dependencies [9413745]
212
+ - Updated dependencies [eaa17ad]
213
+ - Updated dependencies [5c9d2d5]
214
+ - Updated dependencies [c95868e]
215
+ - Updated dependencies [24c7e15]
216
+ - Updated dependencies [ab05878]
217
+ - Updated dependencies [70ef8a0]
218
+ - Updated dependencies [b9907eb]
219
+ - Updated dependencies [d3c62fa]
220
+ - Updated dependencies [1c17d91]
221
+ - Updated dependencies [ba95590]
222
+ - Updated dependencies [99678b8]
223
+ - Updated dependencies [1e15351]
224
+ - Updated dependencies [7eed455]
225
+ - Updated dependencies [91ede7d]
226
+ - Updated dependencies [303b935]
227
+ - Updated dependencies [ca28445]
228
+ - Updated dependencies [2d1a70b]
229
+ - Updated dependencies [385cbe0]
230
+ - Updated dependencies [ff7bdae]
231
+ - Updated dependencies [fe8540b]
232
+ - Updated dependencies [9b834c7]
233
+ - Updated dependencies [accf0d6]
234
+ - Updated dependencies [decec09]
235
+ - Updated dependencies [0ceae40]
236
+ - @unotest/dsl@0.50.0
237
+ - @unotest/core@0.50.0
238
+ - @unotest/viewer@0.50.0
239
+ - @unotest/protocol@0.50.0
240
+ - @unotest/grounder-client@0.50.0
241
+
242
+ ## [0.49.2] - 2026-10-12
243
+
244
+ ### Patch Changes
245
+
246
+ - 29fc1f3: A test that fails on a page whose main thread is busy no longer spends a long wait collecting its failure bundle. The runner first asks the page a question that costs it nothing, with a short budget; a page that does not answer is not read at all. Each part of the bundle that was not read now holds the reason where it would be (`screenshot-error.txt`, `page-html-error.txt`, `outline-error.txt`) instead of being missing without a word. Assertions keep their own `timeout` on such a page: the page's reads count against it, so `assertText(loc, x, {timeout: 400})` fails after about 400 ms and says the page gave no answer, instead of waiting out the action timeout. `assertNeverAppears` no longer passes on a page that stops answering: absence is proven only by reads that answered for the whole window, so it fails and says the page gave no answer.
247
+ - 5c29258: A failure bundle no longer holds an empty `console.json` when the browser console was not recorded. The console is recorded only with `UNOTEST_CONSOLE=1`; without it, the file is left out, `get_failure_console` answers `entries: null` with a message naming the variable, and the `prepare-fix` prompt says the console was not recorded instead of "no console entries captured".
248
+ - 50a9980: `env(name, fallback)` returns `fallback` when the variable is not set, a default in one line: `api = env('API_URL', 'http://localhost:3000')`. Before, it took an `if` / `else`: the DSL has no `??`, and `env('X') || 'default'` gives `true`, not the value. Without a fallback `env(name)` still returns `null` for an unset name. A secret is refused as before, with a fallback or without.
249
+ - 4df2165: `evaluate(js)` on a page whose main thread is busy, a script loop or a long task, now fails the step after the action timeout with "the page gave no answer" instead of holding the test forever. `evaluateOnLocator` already did. A script that has started still runs as long as it needs.
250
+
251
+ Inside an entered frame, the function form of `evaluate`, `evaluate('function(n) { … }', 21)`, now receives its argument. Before, it received the frame's root element.
252
+
253
+ - 5df0f20: A lambda passed to `evaluate` or `evaluateOnLocator` is now answered with what to write: the JavaScript goes in as a string, so quote the lambda — `evaluate('() => new Date().toISOString()')`. `lint` and a run say the same. Before, both said to call a helper function by name, which pointed the wrong way. For targets built on `@unotest/dsl`: the contract registry and the dispatcher take an optional `suggestForLambdaArgument(name)` hook for this answer.
254
+ - fa28983: A failed test in the CLI now prints where its failure bundle is, as an absolute path on stdout (`failure bundle: /…/.unotest/failures/<runId>/<test>`), so it opens from any working directory. The run journal keeps `bundlePath` and `screenshotPath` relative to the project root (the directory holding `.unotest/` and `unotest/`), and the agent integration guide now says so.
255
+ - eed900d: `getByRole(role, options)` now reads Playwright's state options: `checked`, `disabled`, `expanded`, `pressed`, `selected`, `level` and `includeHidden`, next to `name` and `exact`. Before, every key but `name` and `exact` was dropped without a word, so `count(getByRole('button', {name: 'Save', disabled: false}))` also counted a disabled Save button and the check went green. Any other key is now refused, at lint time (new rule `lint:role-unknown-option`, an error by default) and at run time, with the list of keys it reads.
256
+
257
+ The MCP locator input takes the same options on a `getByRole` step and refuses any other key instead of stripping it. A recorded step keeps them, and the generated test writes them out.
258
+
259
+ - 26d31d7: `lint:env-host-from-base` now finds the host variable of a `goto` inside a ternary and in a longer sum: `goto(ready ? APP_URL : '/x')` and `goto(APP_URL + '/a' + '/b')` were not checked before. A variable used only as the ternary's condition is not taken for the host.
260
+ - 29fc1f3: `unotest-web init --help` prints its usage once. It used to print it twice, while every other command printed its help once.
261
+ - 9dcc571: A test run no longer creates `unotest/jsconfig.json`. `e2e`, `lint` and MCP `run_test` used to write it into your tree when it was missing; now only `init` and `types` write it, and `init` adds `unotest/jsconfig.json` to `.gitignore`. A run still refreshes the gitignored `.unotest/types/env.d.ts` with your variable names.
262
+
263
+ Migration: a checkout without the file (a new clone, a teammate's machine) gets editor typings back with `npx @unotest/web types`. A `jsconfig.json` you already commit stays as it is; remove the new `.gitignore` line if you want to keep committing it.
264
+
265
+ - 22a848b: `locator(selector, options)` now reads its options: `hasText`, `hasNotText`, `has` and `hasNot` narrow the matches exactly as `filter()` does, and any other key is refused at lint time and at run time. Before, the second argument was dropped without a word, so `count(locator('option', {hasText: 'Beta'}))` counted every option.
266
+
267
+ New `isChecked(loc)` reads the checked state of a checkbox, radio or switch, native or ARIA role. An element with no checked state fails the step instead of reading `false`.
268
+
269
+ `check` / `uncheck` now click and wait until the element reads checked (unchecked) within the action timeout. A controlled switch the app flips a moment after the click, once the server confirms, no longer fails with "did not change its state". An element already in the target state is not clicked, as before. A switch that never flips fails, naming the state it wanted and the last one it saw. `check` / `uncheck` on an element that is not a checkbox, radio or switch is refused; use `click` for it.
270
+
271
+ A `<label>`, or anything inside one, stands for the checkbox it names, as in Playwright: `check`, `uncheck` and `isChecked` on `getByText('Remember me')` act on and read the labelled checkbox. `assertValue(label, "true")` on such a label now asserts the checkbox's checked state too, instead of comparing against its submitted value `"on"`.
272
+
273
+ - abd74f5: `locator(selector, options)` and `filter(loc, options)` now refuse options that are not an object, naming the function: `locator('option', 5)` and `filter(loc, null)` used to build a filter with no conditions and match everything, and `locator('option', null)` failed with a bare `TypeError`. `filter(loc)` with no options is unchanged. `getByRole(role, {exact})` now takes only `true` or `false`, like its state flags; `{exact: 'yes'}` used to count as `true`.
274
+ - 6a6712c: MCP locator input now refuses a regex `source` that does not compile, with "regex source does not compile" and the engine's reason, instead of failing later when the locator runs. A recorded regex is written into the generated test with `/` and line breaks escaped, so a source holding `/` can no longer close the literal and add code to the test.
275
+ - 98aeab8: `e2e --notes` and `collection --notes` print every `note()` of every test under its line, a passing test's too, as `note <label>: <value> — step "<step>"`. A failed test lists them in place of the failing step's own notes, so none prints twice. Without the flag the output is unchanged.
276
+ - 51f06c9: Notes printed under a test line (`--notes`, and the notes of a failing step) now show line breaks and terminal escape sequences escaped, as `\n` and `\x1b`. A note's value often comes from the page under test, and an escape sequence in it used to reach the terminal as an instruction, and a line break could forge a line of the report.
277
+ - 0447cec: A `__proto__` key in an object literal is now an ordinary key of that object, as in JSON, instead of setting its prototype. `getByRole('button', {__proto__: {name: 'Save'}})` was refused by the lint, but the run read `name` through the prototype and matched on it. The run now refuses `__proto__` as an unknown option too, with the lint's message.
278
+ - 92242d3: A run on a browser profile (`launch.userDataDir` or `UNOTEST_USER_DATA_DIR`) no longer prints a line about it on every run. The run journal records it instead: the `run:started` event in `steps.jsonl` carries `browserProfile`, the profile directory the run played on. Its presence means every scenario shared one browser context, with no isolation between them. Runs with a fresh context per test have no such field.
279
+ - a1e8482: Scenarios can use the ternary `cond ? a : b`, as in JS: the lowest precedence, nested to the right, and allowed wherever a value goes — a variable, a call argument, an object field, a `return`, a lambda body. Only the branch the condition picks runs, so `x == null ? '' : x.name` is a safe guard. `lint` accepts a ternary in a slot when both branches fit it. `?.` and `??` are still refused, and the parse error now points to the ternary or `if` / `else`.
280
+ - 6b9ceee: New `texts(loc)` returns the `textContent` of every element the locator matches, in page order, and `[]` when nothing matches. It is one read with no wait: the list to branch on, where `assertTexts` is the waiting check. Before, the only way to get that list was `count` plus `nth(i)` in a loop, since `textContent` on several matches is a strict-mode error.
281
+ - 65a81be: The viewer no longer paints a test marked `@expect-fail` as failed on purpose when it errored. The tile, the tree dot, the scenario header and the history strips now read the marker the runner recorded for each run, not the marker in the source today: a marked test that failed is purple, the same test erroring on a script error is red and counts as failing. The run index records that reading per run and is rebuilt once on the first start after the update. The scenario header of a one-test file now shows `expected` in the same purple as the tree, instead of `failed`.
282
+ - Updated dependencies [5df0f20]
283
+ - Updated dependencies [98aeab8]
284
+ - Updated dependencies [0447cec]
285
+ - Updated dependencies [92242d3]
286
+ - Updated dependencies [a1e8482]
287
+ - Updated dependencies [65a81be]
288
+ - @unotest/dsl@0.49.2
289
+ - @unotest/core@0.49.2
290
+ - @unotest/protocol@0.49.2
291
+ - @unotest/viewer@0.49.2
292
+ - @unotest/grounder-client@0.49.2
293
+
3
294
  ## [0.49.1] - 2026-10-11
4
295
 
5
296
  ### Patch Changes
@@ -1813,7 +2104,7 @@ picker on` fetches this project's own access and writes the three grounder
1813
2104
 
1814
2105
  That screen named one command:
1815
2106
 
1816
- npx @unotest/web bundle push --run --env ENVIRONMENT
2107
+ npx @unotest/web bundle push --run --env ENVIRONMENT
1817
2108
 
1818
2109
  In a project that has just been created, the command refuses with `no box
1819
2110
  address` before it does anything: the project holds neither the box's address
@@ -1822,8 +2113,8 @@ address` before it does anything: the project holds neither the box's address
1822
2113
 
1823
2114
  The screen now names both steps, in the order they have to happen:
1824
2115
 
1825
- npx @unotest/web box access larch
1826
- npx @unotest/web bundle push --run --env ENVIRONMENT
2116
+ npx @unotest/web box access larch
2117
+ npx @unotest/web bundle push --run --env ENVIRONMENT
1827
2118
 
1828
2119
  The box's own name is filled in when its licence carries one. `box access`
1829
2120
  with no name refuses, and its refusal offers to create a box — to somebody who
package/README.md CHANGED
@@ -29,15 +29,16 @@ overwrites your edits.
29
29
 
30
30
  It also wires editor typings (`unotest/jsconfig.json` + generated `.d.ts`
31
31
  files), so scenarios get autocomplete, hover docs and signature help in
32
- VS Code / WebStorm instead of red squiggles. On an existing project this
33
- self-installs on the first `lint` / `e2e` run after upgrading; refresh by
34
- hand with `npx @unotest/web types`. Details: the "Editor setup" section of
32
+ VS Code / WebStorm instead of red squiggles. On an existing project or a
33
+ fresh checkout, `npx @unotest/web types` writes them; a test run does not.
34
+ Details: the "Editor setup" section of
35
35
  `node_modules/@unotest/web/guides/dsl-reference.md`.
36
36
 
37
37
  Testing a browser extension? `launch` in `unotest.config` starts the browser
38
38
  with a profile (`userDataDir`) and extra arguments (`args`, e.g.
39
39
  `--load-extension=./ext`; Chromium only). On a profile every scenario shares
40
- one browser context — no isolation between them, and the run log says so.
40
+ one browser context — no isolation between them, and the run journal records
41
+ the profile.
41
42
  `profile: 'per-test'` instead gives every test a new browser on a new,
42
43
  empty profile: a suite of N files runs on N profiles.
43
44
 
@@ -52,6 +52,8 @@ const asksForHelp = args.some((a) => a === "--help" || a === "-h");
52
52
  // under src/. In published packages dist/ exists (built by prepublishOnly);
53
53
  // in a fresh clone we fall back to running TS sources via tsx so that
54
54
  // `unotest-web --help` works without an explicit `pnpm build` first.
55
+ const INIT_DIST = "dist/runner/init.js";
56
+
55
57
  /** The cli dispatcher's route. It stops when this wrapper is gone, through
56
58
  * an IPC channel (see the spawn below); the other entries are not told. */
57
59
  function cliRoute(forwardArgs) {
@@ -74,11 +76,12 @@ function dispatch(sub) {
74
76
  case "e2e":
75
77
  return cliRoute(args);
76
78
  case "init":
77
- return {
78
- dist: "dist/runner/init.js",
79
- src: "src/runner/init.ts",
80
- forwardArgs: args.slice(1),
81
- };
79
+ // Built: imported and called in this process (see below). Without
80
+ // dist/ the cli dispatches it under tsx — init.ts runs nothing on
81
+ // import, so it is never an entry of its own.
82
+ return existsSync(resolve(root, INIT_DIST))
83
+ ? { dist: INIT_DIST, src: "src/runner/init.ts", forwardArgs: args.slice(1) }
84
+ : cliRoute(args);
82
85
  case "install-chromium":
83
86
  return {
84
87
  dist: "dist/runner/install-chromium.js",
@@ -122,10 +125,8 @@ const distPath = resolve(root, dist);
122
125
  // npx loses the prompt suffix mid-flush on some shells (Claude Code's
123
126
  // REPL, nvm shim variants). Direct import keeps stdio attached to the
124
127
  // real TTY without a spawn hop. We import the compiled module and call
125
- // `runInit` directly so we can await its promise — the module's own
126
- // self-invoke `if (invokedDirectly)` block fires only when bin spawns
127
- // a child, which we explicitly skip here.
128
- if (sub === "init" && !asksForHelp && existsSync(distPath)) {
128
+ // `runInit` directly so we can await its promise.
129
+ if (dist === INIT_DIST) {
129
130
  const initModule = await import(pathToFileURL(distPath).href);
130
131
  try {
131
132
  const { exitCode } = await initModule.runInit(forwardArgs);