Implement effect-rstest: port of @effect/vitest to the Rstest runner - #1
Conversation
… paths) Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
|
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
commit: |
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5f8d5f964
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (Schema.isSchema(arbitrary)) { | ||
| throw new Error("Schemas are not supported yet") | ||
| } |
There was a problem hiding this comment.
Convert schemas before registering synchronous property tests
When it.prop receives any Schema—an input explicitly accepted by Vitest.Arbitraries and documented as supported—this throws during test-file collection instead of running the property. The object-arbitraries branch has the same behavior, so synchronous schema-based properties cannot be used; convert schemas with Schema.toArbitrary, as the effectful prop implementation already does.
Useful? React with 👍 / 👎.
| export const addEqualityTesters = () => { | ||
| Rs.expect.addEqualityTesters([]) | ||
| } |
There was a problem hiding this comment.
Register the Effect equality tester
Calling the exported addEqualityTesters() currently adds an empty list and is therefore a no-op. Consumers relying on this API to make Rstest honor Effect's Equal semantics will still get ordinary structural equality, causing semantically equal Effect values to fail toEqual; pass the Effect equality tester to Rs.expect.addEqualityTesters instead.
Useful? React with 👍 / 👎.
Canary install
Every push publishes a preview via pkg.pr.new. See the bot comment for the latest SHA-stable URL, or track this PR head:
Summary
Implements
effect-rstest, the Rstest equivalent of Effect's official@effect/vitesthelpers for Effect v4. Ported from Effect commit2600f62(@effect/vitest@4.0.0-rc.112).itwitheffect,live,layer,prop, andflakyTesteffect,live,layer,prop,flakyTest,addEqualityTesters,makeMethods, anddescribeWrapped@rstest/coreeffect-rstest/utilsRstest-specific behavior
getCurrentSuite(). Unnamedlayer(...)((it) => ...)blocks use an empty nested suite as their lifecycle boundary. Rstest omits the empty suite name from test paths, and the layer is released before subsequent tests in the enclosing suite. A regression test covers this boundary.describeWrappedreturnsvoidbecause Rstest'sdescribehas noSuiteCollector; its wrapped globalitregisters in the active suite. A runtime test covers the enhanced API.skipIf/runIfconditions are coerced to boolean because Rstest types them asbooleanrather thanunknown.void/Promise<void>.Vitestfor source compatibility with the canonical package. This avoids shadowing and preserves theRstestutility type re-exported from@rstest/core; a type test covers both.Second-pass review fixes
afterAllfallback left scoped resources alive for later sibling tests. The anonymous nested-suite fallback now matches upstream's release boundary.Vitesthelper namespace and the previously shadowed@rstest/coreRstesttype export.@rstest/corepeer floor from^0.11.0to^0.11.11. Earlier allowed versions do not provide all APIs used by this port (TestContext.signaland exportedTestAPIs).describeWrapped, plus a type-level re-export regression test.Reviewed and intentionally retained:
srcremains infiles, matching upstream's distributed-source visibility; consumers resolve only the explicitdistexports.prepublishOnly: npm run buildworks under pnpm and also keeps directnpm publishsafe; no package-manager-specific change is needed.Verification
Fresh local run after the review fixes:
pnpm check— cleanpnpm test— 3 files, 42 passed / 5 intentionally skipped (47 total)pnpm test:types— 8 tests, 9 assertions passedpnpm build— generateddist/index.mjs,dist/utils.mjs, and paired.d.mtsdeclarationspnpm publint(--strict) —All good!