Repository navigation
test(repo): move xstate's test files runtimeValidation to waitFor onto the guard API - #56
Closed
systemfsoftware-maker wants to merge 5 commits into
Closed
systemfsoftware-maker wants to merge 5 commits into
systemfsoftware-maker wants to merge 5 commits into
Conversation
…o the guard API Thirty-four test files under packages/xstate/test register through @systemfsoftware/vitest with generator bodies and yielded expects, and leave packages/unguarded-tests.json. Every case name and status matches main except two it.todo cases in toPromise and transition, which are now real passing tests. systemTransition and v5ConfigDiagnostics stay on the list
systemfsoftware-maker
added this pull request to stack #49
October 8, 2026 01:41
systemfsoftware-maker
marked this pull request as ready for review
October 8, 2026 01:41
systemfsoftware-maker
removed this pull request from stack #49
October 8, 2026 02:07
systemfsoftware-maker
added this pull request to stack #59
October 8, 2026 02:07
# Conflicts: # packages/unguarded-tests.json
Contributor
|
Closed unmerged: these layers preserve upstream's example suite case-for-case, which violates CONST-T10 (call-graph asserts) and CONST-T14/T15. Replaced by per-capability contract tests with named mutation sets (conductor cycle 98). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves 34 test files under
packages/xstate/test,runtimeValidation.test.tsthroughwaitFor.test.ts, onto the@systemfsoftware/vitestguard API (generator bodies, yieldedexpect). The layer removes exactly those 34 entries frompackages/unguarded-tests.json. No file undersrcchanges.systemTransition.test.tsandv5ConfigDiagnostics.test.tsstay on the list (see Held).Stacked on #55.
Shape
toHaveBeenCalled*77 → 0,toBeDefined35 → 0,toHaveLength21 → 0,not.toThrow12 → 0,toBeTruthy10 → 0,toMatchInlineSnapshot9 → 0,.resolves/.rejects7 → 0,toBeFalsy4 → 0,toBeInstanceOf2 → 0. Inline snapshots became literals from their committed values. Call-count matchers became exact recorded call lists.vi(111 → 0).vi.fnbecame per-test recorder arrays, and fake timers became the injectedclock.@ts-expect-errordirectives on both sides, each on the expression it guards.it.todocases became real tests.toPromise.test.ts› "should immediately reject for an actor that had an error": an actor whose entry action throws has statuserror, andtoPromiserejects with that same error (Error: oh noes).transition.test.ts› "delayed raise actions should be returned":initialTransitionreturns the delayed raise as its first action. Main's todo expectedparams: [{ type: 'NEXT' }, { delay: 10 }], a shape this fork's raise action does not have. The test asserts the fork's fields,event: { type: 'NEXT' }anddelay: 10.Parity
Case names and statuses from vitest JSON runs, against main's baseline. Columns: base cases, head cases, missing, added, changed status.
test/runtimeValidation.test.tstest/runtimeValidation.types.test.tstest/select.test.tstest/serialization.conformance.v6.test.tstest/setup.test.tstest/setupStateContracts.test.tstest/sourceTyping.types.test.tstest/spawn.test.tstest/spawn.types.test.tstest/spawnChild.test.tstest/state.test.tstest/stateIn.test.tstest/stateInput.persistence.test.tstest/stateInput.test.tstest/strictTargets.types.test.tstest/system.test.tstest/systemOnRejectedEvent.test.tstest/tags.test.tstest/timeout.test.tstest/timers.persistence.test.tstest/toPromise.test.tstest/transient.test.tstest/transition.test.tstest/transitionFunctions.test.tstest/trigger.test.tstest/typeHelpers.test.tstest/types.test.tstest/typeSchemas.test.tstest/typeStates.test.tstest/unhandledEvents.test.tstest/v6.test.tstest/versioning.test.tstest/vizTypeFriction.types.test.tstest/waitFor.test.tsThe two changed rows are the todo → passed cases above. Main already has one duplicate full name in
types.test.ts("events should not allow a transition using an event type matching the possible prefix..."), so both sides run 729 cases under 728 distinct names.Evidence
src/toPromise.ts:33resolvesundefinedinstead of the actor's output, giving 4 failed intoPromise.test.ts. Restored:git diff --quietexit 0.packages/xstatejson run (2442 passed, 29 skipped, 0 failed), seeds 1-3 on the 34 files (--sequence.seed),tsc -b, turbolint:tsgo(--force) anddprint check: all exit 0.Held
systemTransition.test.ts› "does not consult wall time, native timers or live actor instances" makesDate.nowandsetTimeoutthrow for the duration of a pure system transition, to prove the transition reads neither. Both are global patches that the file's concurrently running cases would observe, and the pure functions take no clock to inject. The file stays unguarded until that observation has a form that patches no global.v5ConfigDiagnostics.test.tscaptures construction-time warnings by replacingconsole.warn(theStateNodediagnostics have no actor and no sink), and its "reports nothing in production builds" case stubsNODE_ENVand module-mocks#is-development. Both stay until those diagnostics have a sink and the production branch can be reached without a module mock.Remaining
13 files on
packages/unguarded-tests.json: xstate 3 (inspect,systemTransition,v5ConfigDiagnostics), xstate-react 8, xstate-store-react 2.No local mutation runs.