Skip to content

feat(rstest): add @effect/rstest package - #7976

Closed
ScriptedAlchemy wants to merge 2 commits into
Effect-TS:mainfrom
ScriptedAlchemy:feat/rstest-package
Closed

ScriptedAlchemy wants to merge 2 commits into
Effect-TS:mainfrom
ScriptedAlchemy:feat/rstest-package

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown

Summary

Adds @effect/rstest (packages/rstest), the Rstest counterpart of @effect/vitest.

Rstest is intentionally Vitest-compatible, so the package is a near line-for-line port of the current @effect/vitest (including the native Arbitrary property-testing runner from #7254) with vitest swapped for @rstest/core. The public API is the same:

  • Enhanced it with effect, live, layer, prop, flakyTest
  • Top-level effect, live, layer, prop, flakyTest, addEqualityTesters, makeMethods, describeWrapped
  • @effect/rstest/utils assertion helpers (identical to @effect/vitest/utils)
  • Re-exports everything from @rstest/core

This has been living as a community package (ScriptedAlchemy/effect-rstest) and is used in production test suites; upstreaming it keeps it in lockstep with @effect/vitest and Effect v4 releases.

Differences forced by the runner

Documented in packages/rstest/README.md under "Differences from @effect/vitest":

  • describeWrapped returns void — Rstest's describe returns no SuiteCollector and its callback receives no it.
  • Unnamed layer(...)((it) => ...) blocks — Rstest exposes no getCurrentSuite(), so the block's tests can't be enumerated like @effect/vitest does. An empty nested describe("") is used as the lifecycle boundary instead (Rstest omits empty suite names from test paths; beforeAll/afterAll build and release the layer around the block). test/isolation.test.ts has a regression test for the release boundary.
  • it.describe — Rstest's it has no describe, so the enhanced it attaches the runner's describe to keep it.describe.each(...) working.
  • { fails: true } in test options — Rstest only reads timeout/retry/repeats/meta from the options object, so fails is mapped onto the it.fails modifier (Vitest.TestOptions adds it to the type).
  • skipIf / runIf — Rstest types the condition as boolean; the public API still accepts unknown and coerces.
  • The Effect type namespace is still called Vitest (Vitest.Methods, ...) so test files can move between the two packages without touching type imports.

Monorepo wiring

  • tsconfig.packages.json reference, tsconfig.tests.json path alias (+ **/rstest.*.ts include), root devDependency
  • .changeset/config.json: added to the fixed group so it versions with @effect/vitest; version set to 4.0.0-rc.112 to match
  • deno.json: exclude **/rstest.*.ts like the vitest configs
  • New Test (Rstest) CI job running pnpm --filter @effect/rstest test. The Rstest suite cannot run under the root Vitest projects, so it is not part of pnpm test
  • README package table entry
  • @rstest/core pinned to 0.11.10 as devDependency (peer >=0.11.0 <1.0.0); 0.11.12 is newer than the pnpm minimumReleaseAge gate

Verification

  • pnpm check (repo-wide, includes packages/rstest/{test,typetest})
  • pnpm --filter @effect/rstest test — 57 tests, 52 passed, 5 skipped (the same skipped cases as @effect/vitest)
  • pnpm test-types --target '>=5.9' — 172 files incl. packages/rstest/typetest/index.tst.ts
  • pnpm lint, pnpm circular, pnpm --filter @effect/rstest build, node scripts/copy-ai-docs.mjs
  • pnpm vitest run --project @effect/vitest unchanged (44 passed, 5 expected fail, 5 skipped)
  • deno check . was not run locally (no Deno installed); relying on the Types CI job

Add @effect/rstest, the Rstest counterpart of @effect/vitest. The public API
mirrors @effect/vitest (it.effect, it.live, it.layer, it.prop, it.flakyTest,
describeWrapped, makeMethods, addEqualityTesters, @effect/rstest/utils) on top
of @rstest/core, with the runner-specific differences documented in the README.
@changeset-bot

changeset-bot Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49d778e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 packages
Name Type
@effect/rstest Patch
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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-04T02:35:29.171864Z 49d778e Manual request
ℹ️ 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: 445937f7f9

ℹ️ 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".

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 34.05 KB 34.05 KB 0.00 KB (0.00%)
basic.ts 7.15 KB 7.15 KB 0.00 KB (0.00%)
batching.ts 10.38 KB 10.38 KB 0.00 KB (0.00%)
brand.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
cache.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
config.ts 21.75 KB 21.75 KB 0.00 KB (0.00%)
differ.ts 20.55 KB 20.55 KB 0.00 KB (0.00%)
http-client.ts 22.20 KB 22.20 KB 0.00 KB (0.00%)
http-router.ts 32.90 KB 32.90 KB 0.00 KB (0.00%)
logger.ts 11.12 KB 11.12 KB 0.00 KB (0.00%)
metric.ts 9.25 KB 9.25 KB 0.00 KB (0.00%)
optic.ts 6.87 KB 6.87 KB 0.00 KB (0.00%)
pubsub.ts 15.49 KB 15.49 KB 0.00 KB (0.00%)
queue.ts 12.09 KB 12.09 KB 0.00 KB (0.00%)
schedule.ts 11.20 KB 11.20 KB 0.00 KB (0.00%)
schema-binary.ts 39.70 KB 39.70 KB 0.00 KB (0.00%)
schema-class.ts 20.32 KB 20.32 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.48 KB 30.48 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 26.41 KB 26.41 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.89 KB 13.89 KB 0.00 KB (0.00%)
schema-string.ts 11.38 KB 11.38 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.76 KB 15.76 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 33.59 KB 33.59 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.76 KB 24.76 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 19.51 KB 19.51 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 19.65 KB 19.65 KB 0.00 KB (0.00%)
schema-toFormatter.ts 19.77 KB 19.77 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 23.84 KB 23.84 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.79 KB 19.79 KB 0.00 KB (0.00%)
schema.ts 19.53 KB 19.53 KB 0.00 KB (0.00%)
stm.ts 13.03 KB 13.03 KB 0.00 KB (0.00%)
stream.ts 10.06 KB 10.06 KB 0.00 KB (0.00%)

- `run` returns `Promise<void>` via `Effect.asVoid` instead of `Promise<any>`,
  removing the `as any` in `each`
- `{ fails: true }` is mapped to `it.fails` for skip/only/skipIf/runIf/each too,
  not only the base tester and `prop`
- `testOptions` matches the vitest one-liner (rstest ignores unknown keys)
- trim comments to the surrounding style; simplify the re-export typetest
@ScriptedAlchemy

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 49d778e6d4

ℹ️ 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".

@tim-smart

Copy link
Copy Markdown
Contributor

Feel free to make this a community package :) We don't want to take on the maintenance burden at this time.

@chenjiahan

Copy link
Copy Markdown

This branch had an error being deployed

1 failed deployment
fork — 49d778e6 Deployed Sep 4, 2026 by ScriptedAlchemy via approval-gate #13928
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants