Skip to content

fix(vscode): accept rstest 0.13 reporter statuses alongside pre-0.13 - #127

Merged
fi3ework merged 1 commit into
mainfrom
fix/rstest-status-compat
Nov 5, 2026
Merged

fi3ework merged 1 commit into
mainfrom
fix/rstest-status-compat

Conversation

@fi3ework

@fi3ework fi3ework commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

rstest 0.13 (web-infra-dev/rstest#1875, commit ffc4eb29) renames the reporter status literals:

 TestResultStatus (test/suite/file results)
-  pass | fail | skip | todo
+  passed | failed | skipped | todo

 TestRunStatus (run() result / onTestRunEnd)
-  pass | fail | error
+  passed | failed | error

0.13 is not on npm yet (latest 0.12.6), but the extension resolves @rstest/core from the user's project, so a project that upgrades would hit the new vocabulary with SUPPORT_MATRIX['@rstest/core'] = '>=0.12.0' still satisfied. The two switches in TestRunReporter and the worker's run guard would then match no case: file and case items never finish, and an operation-level failure reads as success.

Both lines now run through one compat module:

runtime payload (pass|fail|skip  or  passed|failed|skipped)
  │
  ├─ TestRunReporter.onTestFileResult ── normalizeTestResultStatus ── switch(passed|failed|skipped|todo)
  ├─ TestRunReporter.onTestCaseResult ── normalizeTestResultStatus ── switch(passed|failed|skipped|todo)
  └─ Worker.executeTestRun ───────────── normalizeTestRunStatus ──── 'error' | 'failed' | undefined
packages/vscode/
├── src/stacks/test/
│   ├── compat/rstestPre013.ts       # only place knowing the pre-0.13 literals + removal checklist
│   ├── testRunReporter.ts           # both switches read the normalized value
│   └── worker/index.ts              # run status normalized once per run
└── tests/stacks/test/
    ├── rstestPre013.test.ts         # normalizer table (legacy / latest / unknown)
    ├── testRunReporter.test.ts      # file + case handlers, both vocabularies, unknown status
    └── master.test.ts               # run guard: latest + one tagged legacy case

Consumers speak only the 0.13 vocabulary; every compat call site carries COMPAT(rstest<0.13). Pre-0.13 support is meant to be dropped later, so removal is: delete compat/rstestPre013.ts and its test, then grep -rn "COMPAT(rstest<0.13)" packages/vscode and remove those sites. The full checklist lives in the module header and in packages/vscode/AGENTS.md → Active compatibility shims.

Unknown statuses do not guess: the normalizers return undefined, the reporter's default: logs, and the worker logs a warning instead of treating the run as a success.

Evidence

  • Before: with 0.13's passed|failed|skipped, switch (test.status) / switch (result.status) match nothing — items stay started, run.failed() never fires, and result.status === 'fail' never throws for a threshold failure.
    After: pnpm lint → Lint and type check passed (207 files); pnpm test:unit → 420 tests / 420 passed, 0 failed (41 files); VSCODE_CLI=1 pnpm test:e2e rstest → exit 0, no failing suites.

CI's E2E runs the published legacy line (@rstest/core 0.12.6). The 0.13 line was verified locally against an rstest main build (see Testing); a pinned 0.13 fixture follows once 0.13 publishes.

Testing

  • pnpm lint (type-check included): pass, 207 files.
  • pnpm test:unit: 420/420.
  • pnpm build + VSCODE_CLI=1 pnpm test:e2e rstest: exit 0, 0 [e2e-fail] lines.
  • Local, not in CI — rstest E2E slice against web-infra-dev/rstest@74810e2 (main, includes feat(core)!: stabilize reporter contract for 1.0 web-infra-dev/rstest#1875), built from a scratch clone and loaded via rstack.rstest.corePath (logs confirm rstestPath resolved to the main build's dist/index.js):
    • this branch: exit 0, 0 [e2e-fail] lines; 34–42s vs. 38s on 0.12.6 (no hang from 0.13's hook-join dispatch).
    • counterfactual with origin/main's testRunReporter.ts + worker/index.ts: exit 1, 4 failing suites (progress reporting, single test case, debug launch, Test Explorer UX), e.g. progress.test.js:81 0 == 1 — no item ever marked passed.
    • bridge.test.ts was skipped in these local runs only: a global corePath overrides the bridge's resolution by design, which that suite asserts against.

Out of scope

Follow-ups tracked in #115: TestRunEndPayload.status, vendored coreInternals.ts resync, tracked-upstream SHA update, @rstest/core devDependency / fixture bump, a 0.13 E2E fixture.

Refs #115

Merge Danger

Door: two-way — revert restores the old switches; no persisted state, settings or protocol changes.

Blast Radius: test-stack reporting only. Lint and fmt stacks untouched; the compat module is self-contained and the only behavioral additions are the default:/undefined diagnostics.

rstest#1875 renames the reporter status literals (pass|fail|skip ->
passed|failed|skipped; run status pass|fail -> passed|failed). The
extension resolves @rstest/core from the user's project, so both lines
run against one build.

Route every status read through one compat module, keep consumers on the
0.13 vocabulary, and tag the call sites COMPAT(rstest<0.13) so dropping
pre-0.13 support is a delete plus a grep.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T07:13:20.810335Z f8e65bb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@fi3ework
fi3ework merged commit 7159835 into main Nov 5, 2026
3 checks passed
@fi3ework
fi3ework deleted the fix/rstest-status-compat branch November 5, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant