Skip to content

Implement effect-rstest: port of @effect/vitest to the Rstest runner - #1

Merged
ScriptedAlchemy merged 8 commits into
mainfrom
cursor/effect-rstest-port-2f70
Sep 3, 2026
Merged

ScriptedAlchemy merged 8 commits into
mainfrom
cursor/effect-rstest-port-2f70

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 1, 2026 •

Copy link
Copy Markdown
Owner

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:

pnpm add https://pkg.pr.new/ScriptedAlchemy/effect-rstest@1

Summary

Implements effect-rstest, the Rstest equivalent of Effect's official @effect/vitest helpers for Effect v4. Ported from Effect commit 2600f62 (@effect/vitest@4.0.0-rc.112).

  • Enhanced it with effect, live, layer, prop, and flakyTest
  • Top-level effect, live, layer, prop, flakyTest, addEqualityTesters, makeMethods, and describeWrapped
  • All runtime exports from @rstest/core
  • Assertion helpers at effect-rstest/utils
  • Ported upstream runtime and type tests running on rstest
  • Publishable ESM package built with tsdown
  • Strict publint validation in CI
  • Independent pkg.pr.new canary workflow

Rstest-specific behavior

  • Rstest has no public getCurrentSuite(). Unnamed layer(...)((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.
  • describeWrapped returns void because Rstest's describe has no SuiteCollector; its wrapped global it registers in the active suite. A runtime test covers the enhanced API.
  • skipIf / runIf conditions are coerced to boolean because Rstest types them as boolean rather than unknown.
  • Effect test return values are ignored because Rstest callbacks require void / Promise<void>.
  • The helper type namespace remains Vitest for source compatibility with the canonical package. This avoids shadowing and preserves the Rstest utility type re-exported from @rstest/core; a type test covers both.

Second-pass review fixes

  • Fixed a real unnamed-layer leak: the previous enclosing-suite afterAll fallback left scoped resources alive for later sibling tests. The anonymous nested-suite fallback now matches upstream's release boundary.
  • Restored the canonical Vitest helper namespace and the previously shadowed @rstest/core Rstest type export.
  • Raised the @rstest/core peer floor from ^0.11.0 to ^0.11.11. Earlier allowed versions do not provide all APIs used by this port (TestContext.signal and exported TestAPIs).
  • Added focused runtime tests for unnamed-layer release and describeWrapped, plus a type-level re-export regression test.

Reviewed and intentionally retained:

  • src remains in files, matching upstream's distributed-source visibility; consumers resolve only the explicit dist exports.
  • prepublishOnly: npm run build works under pnpm and also keeps direct npm publish safe; no package-manager-specific change is needed.
  • ESM-only output is intentional.

Verification

Fresh local run after the review fixes:

  • pnpm check — clean
  • pnpm test — 3 files, 42 passed / 5 intentionally skipped (47 total)
  • pnpm test:types — 8 tests, 9 assertions passed
  • pnpm build — generated dist/index.mjs, dist/utils.mjs, and paired .d.mts declarations
  • pnpm publint (--strict) — All good!
Open in Web Open in Cursor 

cursoragent and others added 4 commits September 1, 2026 20:01
… 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>
@changeset-bot

changeset-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e5f8d5f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/ScriptedAlchemy/effect-rstest@e5f8d5f

commit: e5f8d5f

cursoragent and others added 3 commits September 1, 2026 20:13
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>
@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 3, 2026 23:47
@ScriptedAlchemy
ScriptedAlchemy merged commit 79abbf6 into main Sep 3, 2026
3 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the cursor/effect-rstest-port-2f70 branch September 3, 2026 23:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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-09-03T23:50:44.096871Z e5f8d5f Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/internal/internal.ts
Comment on lines +163 to +165
if (Schema.isSchema(arbitrary)) {
throw new Error("Schemas are not supported yet")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/internal/internal.ts
Comment on lines +45 to +47
export const addEqualityTesters = () => {
Rs.expect.addEqualityTesters([])
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

2 participants