Skip to content
Effect Days 2026 Get your ticket

@effect/vitest

4.0.0-rc.115

Patch Changes

4.0.0-rc.114

Patch Changes

4.0.0-rc.113

Patch Changes

  • #7254 a63dcbf Thanks @gcanti! - Add the experimental Schema-first effect/unstable/arbitrary/Arbitrary module for native generation without fast-check. Arbitrary.schema derives an opaque arbitrary from the decoded Schema Type, Arbitrary.sampleEffect provides interruptible sampling with typed exhaustion, and Arbitrary.checkEffect returns structured property results. The initial implementation supports bounded discards, shrinking, replay, and recursive and mutually recursive Schemas. SampleError and Exhausted include the effective seed so discarded runs remain reproducible even when the caller did not provide one. Arbitrary.isArbitrary identifies values through the module’s nominal protocol. Numeric constraints retain NaN when it is accepted by their supported Order.Number bounds. Union derivation validates oneOf exclusivity and isolates lazy cross-member shrinking from unrelated random generation. Object derivation keeps optional-property selection constructive when candidate fields have different recursive costs. Struct, Record, JSON-object, and record-shaped Arbitrary.all outputs periodically use a null prototype as an edge case, preserving that prototype throughout shrinking and replay without perturbing structural PRNG choices. The change adds 0.01–0.03 KB gzip to representative Arbitrary fixtures and leaves production-only bundle sentinels unchanged.

    Add Arbitrary.map, Arbitrary.flatMap, Arbitrary.filter, Arbitrary.filterMap, and Arbitrary.all for composing derived Arbitraries without exposing a second catalog of primitive constructors. Filtering remains bounded and promotes valid shrink descendants through rejected nodes. maxShrinks bounds every inspected shrink candidate, including candidates rejected before property evaluation, while retaining the best shrunk input found when the budget is exhausted. flatMap provides deterministic dependent generation, source-first shrinking, post-source PRNG checkpoints, and one shared residual recursion budget. all combines tuples, iterables, and records with a shared budget, randomized internal generation order, stable output shape, and independent member shrinking. Arbitrary values implement Pipeable for composition with data-last combinators.

    Add the experimental Schema arbitraryConstraint and toCodecArbitrary annotations and their Schema.Annotations.ToArbitrary types. Declarations can provide a Schema Link optimized for generation, while filters can contribute native semantic constraints. The callback receives decoded type parameters and normalized constraints. The compiler owns efficient representations for common built-ins, including JSON, RegExp, URL, Date, byte arrays, ReadonlyMap, and ReadonlySet. Effect-specific HashMap, HashSet, Chunk, Graph, BigDecimal, and date-time declarations keep local generation Links, while declarations with productive canonical codecs require no arbitrary-specific annotation. Schema.isUniqueKey provides key-based Map uniqueness for explicit array representations.

    The same ownership policy applies to formatter and equivalence derivation: implementations for common declarations live in their compiler, while domain-specific and dynamically constructed declarations retain local annotations. Declarations whose intrinsic Equal implementation already matches their Schema equivalence need no annotation or compiler special case. This keeps unused common callbacks out of production Schema bundles.

    Against the previous layout, schema-toArbitrary decreases from 36.68 KB to 33.24 KB gzip and arbitrary-combinators decreases from 37.16 KB to 33.70 KB. schema-toFormatter increases from 18.92 KB to 19.49 KB and schema-toEquivalence increases from 19.05 KB to 19.39 KB because callers that explicitly derive these capabilities now retain the common declaration handlers. Generic production fixtures remain unchanged; an equivalence-specific production fixture using common declarations decreases from 20.75 KB to 20.48 KB, while declarations whose intrinsic equality is sufficient decrease from 23.42 KB to 23.34 KB. An Arbitrary-specific production fixture using common declarations decreases from 20.35 KB to 19.61 KB, while one using the locally annotated BigDecimal and date-time declarations increases from 18.34 KB to 23.01 KB. The complete 31-scenario native Arbitrary comparison reports no statistically classified runtime regression; the five moved BigDecimal and date-time scenarios remain within measurement noise.

    Add SchemaGetter.forbiddenEncoding, a reusable getter for the encode side of decode-only Schema transformations.

    Remove the fast-check bridge from the effect package, including Schema.toArbitrary and effect/testing/FastCheck. Replace the legacy Schema.Annotations.ToArbitrary callback contract with the native Schema-first types. The effect package no longer depends on fast-check.

    Migrate TestSchema.Asserts.verifyLosslessTransformation and TestSchema.Asserts.arbitrary().verifyGeneration to the native runner. Both methods now accept native check options directly, bound unsuccessful generation, and include the shrunk input and replay token in property failures.

    Use the Arbitrary runner for all @effect/vitest property tests. Property inputs may combine Schemas and Arbitraries, and are composed directly with Arbitrary.all; check options are available through arbitrary. Raw fast-check arbitraries and the fastCheck options object are no longer supported. As with the previous fast-check adapter, thrown exceptions, defects, and typed failures from a property are shrinkable falsifications; Effect interruption remains an interruption.

    Optimize constructive regular-expression generation by caching feasible lengths on the compiled pattern, computing sequence-suffix feasibility once, and precomputing character-class metadata. Seeded generation, shrinking, and replay remain unchanged.

    Optimize BigDecimal.Order and BigDecimal.Equivalence with a shared hybrid comparator. Ordinary scale differences use cached, bounded coefficient alignment, while large differences are compared without materializing their decimal zeroes. BigDecimal.make now rejects scales that are not safe integers.

    Before its removal, the materialized fast-check bridge fixture schema-toArbitrary-materialized-fast-check.ts measured 79.00 KB minified and gzipped.

    Representative runtime measurements against corresponding hand-written fast-check 4.9.0 arbitraries are shown below. Values are median latency on Node 24.12.0 and Apple M3; lower is better. Both implementations validate the same output domains, although their generation distributions are not identical. Native speedup is fast-check latency divided by Native latency, so higher is better.

    Scenariofast-checkNativeNative speedup
    32 recursive samples150 µs103 µs1.45x
    128 optional Struct samples244 µs86.0 µs2.84x
    128 constrained strings742 µs49.7 µs14.86x
    RegExp derivation and first sample13.4 ms30.8 µs429.02x
    64 RegExp strings595 µs919 µs0.64x
    RegExp failure and shrinking168 µs88.2 µs1.91x
    128 bounded numbers68.9 µs21.8 µs3.18x
    128 Uint8Array samples98.3 µs74.4 µs1.32x
    128 BigDecimal samples66.6 µs56.3 µs1.18x
    128 DateTime.Utc samples71.2 µs50.5 µs1.42x
    128 named time zones52.2 µs27.9 µs1.85x
    128 time zones63.7 µs33.8 µs1.89x
    128 zoned date-times130 µs112 µs1.16x
    32 samples through Schema filter65.9 µs49.4 µs1.33x
    32 unique arrays156 µs132 µs1.18x
    128 literal samples40.0 µs3.70 µs10.78x
    128 mapped samples59.0 µs14.1 µs4.21x
    128 samples through passing filter58.9 µs13.9 µs4.23x
    32 samples through selective filter66.1 µs42.9 µs1.54x
    128 filterMap samples75.7 µs31.5 µs2.40x
    Filtered failure and shrinking12.7 µs7.71 µs1.66x
    128 all tuple samples43.5 µs18.5 µs2.35x
    128 all record samples81.0 µs30.4 µs2.66x
    128 dependent flatMap samples125 µs67.2 µs1.86x
    flatMap failure and shrinking20.1 µs6.71 µs2.99x
    Replay flatMap shrink path14.3 µs6.57 µs2.17x
    Passing property, 100 runs42.3 µs27.1 µs1.56x
    TestSchema, 100 generations44.5 µs35.9 µs1.24x
    First failure plus one shrink8.77 µs1.30 µs6.75x
    Replay recorded failure6.35 µs1.19 µs5.36x

    Cold recursive derivation is not included because the native fixture constructs and compiles a Schema, while the fast-check fixture constructs a hand-written arbitrary; it is not a like-for-like warm-generator comparison.

    Add a guide for the native module and a migration guide from the fast-check bridge published in effect@4.0.0-rc.109.

  • #8154 3993340 Thanks @tim-smart! - Await asynchronous test and layer finalizers after an Effect test times out before starting the next test.

  • #8104 e9915d5 Thanks @tim-smart! - Require Vitest >=5.0.0 <6.0.0 and Node.js ^22.12.0 || ^24.0.0 || >=26.0.0.

    Breaking changes

    • Replace .sequential and { sequential: true } with { concurrent: false }.
    • Use bench from the test context and await bench(name, fn).run(). The top-level benchmark API is removed.
    • Use Assertion<void, T> or Assertion<Promise<void>, T>. Define custom matchers through vitest.Matchers, not @vitest/expect.
    • Import reporter types from vitest/node and environment/snapshot APIs from vitest/runtime. Set outputFile when consuming JSON reports.
    • Await asynchronous assertions. Mock history now clears before each test.

    See the Vitest migration guide for removed types and other upstream changes.

  • #8104 e9915d5 Thanks @tim-smart! - Add a concurrent option to named layer and it.layer suites. Omitted options and anonymous layers preserve inherited concurrency.

  • Updated dependencies [49e3901, b945ded, d6422f4, 5a80204, 53511ef, 79ae49f, 0d083ba, be0f822, debe8fd, a8588f9, f17eb0a, f30cbfe, 78cc9c0, ccbdbd5, a63dcbf, b845b18, 381b794, 4ffcaf4, ba2fd82, 02be94c, 115d8c2, 1452635, 77f85fe, a3f2b31, 310f8d3, 291d616, 48dbbb2, b43bfd6, 1c89c78, 9bbe1a5, dd99ab0, 8f397ed, d7ae6b6, 8cf1203, 87654c5, f05ae0b, 436f5eb, d8ff960, 8766475, b64f406, 4697aaa, cec6c2d, 9956f0e, 5c7eed0, 183c2ea, 1e92dbd, 4eb0fa7, 534b8b9, b76a1cf, acc1e53, 4950a91, c020987, abe95d1, 027ceb9, 3d203b7, a29b8f4, ce4aa65, a8ea807, a3ebb7f, 473bd81, 53843f6, c5eca65, d6f9eba, 8d1e97a, b28ab48, 9960708, 8ac53b6, 84ad49a, 72cfa24, 95c2581, d5c7cd2, fe4fed1, d150a64, 05b1e80, 414dc90, 3f51acd, d68ff05, f3cf1e6, 6525771, 4ab4e83, f7f1d78, 47b358a, 45ffa72, 6232650, 4b73e1b, 284050c, c85fc0b, 7999b07, 7d455f5, d681c2e, 84d2a47, ed74b18, 2245997, d386979, fc9fedf, 7750dbe, fc91af6, 39b9738, 88093b5, d14c463, d473bd3, 84864bc, e2ae724, f921ed3, 1df933d, 829aff9, aa0aba3, a71140f, 0276a27, 10d2c98, c86c999, 975f758, 2a3a478, 1e6e206, fa6027b, 7616f73, fc668b6, d425c8c, ce120f4, 248201f, e80d397, f1a941d, 73bc3a1, b628bb1, 6e3ae7b, e891247, 53e6c73, 1579d6f, d3c6b73, 4a59c6a, 145d8e1, f74282c, 0a38623, 0a08ae0, fa6a56b, d60c5d4, 07ffd25, 9b517ad, 604b1c1, ccc2e02, 14d810a, a9d1ee3, a31adbe, 7245f87, 3a0828b, cd83544, 6550a07, 6f090d4, b505c0d, 186dd49, 9f37e58, 4446451, 58be972, 1320075, ba53b64, f7490d4, c8ea602, 62d82f4, a2c9e7c, 97dd022, f984ee8, f1b2910, a29e05a, 1aa1d8b, bb99734, 222e7ca, 797c9e3, b4d5398, c8349ed, 8426e5f, 26e0085, 1a86166, 0856631, 0af0985, bc582c9, 2c63f1e, 0d98213, ca6f0dc, d8cc9ed, 42fd969, 5641ad3, 629870d, d592c14, 10d2c98, 53909a9, 78a4269, 06c6307, 0847c41, 5a77084, 96f99b3, 7bb8781, 4907e9b, 2a30248, 8364ddd, ad67d8c, ec0c087, fa6a56b, a2c1ce6, 91e9af0, 7bd3f34, ef16581, 1693a87, df3fc47, e11be41, 2e39e8b, 11c5ee7, 1742d2f, 8efc70e, 9642776, 6680828, c34edcb, 7b2c5bd, 1a2ccee, db995df, af0ccdd, addeaea, 7704034, e72b12f, 310dd9c, 1c2afc1, 44f44ca, f43b9d6, 56e72b3, 50ef80e, fc3b718, ee336d8, d12f922, 46d8310, 59812fd, f9d0dec, 4372c79, 81485ef, bd393d6, 0c95c04]:

    • effect@4.0.0-rc.113

4.0.0-rc.112

Patch Changes

4.0.0-rc.111

Patch Changes

4.0.0-rc.110

Patch Changes

4.0.0-rc.109

Patch Changes

4.0.0-rc.108

Patch Changes

4.0.0-beta.107

Patch Changes

4.0.0-beta.106

Patch Changes

4.0.0-beta.105

Patch Changes

4.0.0-beta.104

Patch Changes

4.0.0-beta.103

Minor Changes

  • #6668 83c7497 Thanks @tim-smart! - Require Vitest 4.1 or later and read suite state from TestRunner, removing the direct @vitest/runner import and support for Vitest 3 and 4.0.

Patch Changes

4.0.0-beta.102

Patch Changes

4.0.0-beta.101

Patch Changes

4.0.0-beta.100

Patch Changes

4.0.0-beta.99

Patch Changes

4.0.0-beta.98

Patch Changes

4.0.0-beta.97

Patch Changes

  • Updated dependencies []:
    • effect@4.0.0-beta.97

4.0.0-beta.96

Patch Changes

4.0.0-beta.95

Patch Changes

4.0.0-beta.94

Patch Changes

4.0.0-beta.93

Patch Changes

4.0.0-beta.92

Patch Changes

  • Updated dependencies [affdc13]:
    • effect@4.0.0-beta.92

4.0.0-beta.91

Patch Changes

4.0.0-beta.90

Patch Changes

  • Updated dependencies [d237fdf]:
    • effect@4.0.0-beta.90

4.0.0-beta.89

Patch Changes

4.0.0-beta.88

Patch Changes

4.0.0-beta.87

Patch Changes

4.0.0-beta.86

Patch Changes

4.0.0-beta.85

Patch Changes

4.0.0-beta.84

Patch Changes

4.0.0-beta.83

Patch Changes

  • Updated dependencies [1f2e8ce]:
    • effect@4.0.0-beta.83

4.0.0-beta.82

Patch Changes

  • Updated dependencies [193690b]:
    • effect@4.0.0-beta.82

4.0.0-beta.81

Patch Changes

4.0.0-beta.80

Patch Changes

4.0.0-beta.79

Patch Changes

4.0.0-beta.78

Patch Changes

4.0.0-beta.77

Patch Changes

4.0.0-beta.76

Patch Changes

4.0.0-beta.75

Patch Changes

4.0.0-beta.74

Patch Changes

  • Updated dependencies [b1fc6a4]:
    • effect@4.0.0-beta.74

4.0.0-beta.73

Patch Changes

4.0.0-beta.72

Patch Changes

4.0.0-beta.71

Patch Changes

4.0.0-beta.70

Patch Changes

4.0.0-beta.69

Patch Changes

4.0.0-beta.68

Patch Changes

4.0.0-beta.67

Patch Changes

4.0.0-beta.66

Patch Changes

4.0.0-beta.65

Patch Changes

  • Updated dependencies [6f11454]:
    • effect@4.0.0-beta.65

4.0.0-beta.64

Patch Changes

  • Updated dependencies [7d4877a]:
    • effect@4.0.0-beta.64

4.0.0-beta.63

Patch Changes

4.0.0-beta.62

Patch Changes

  • Updated dependencies [4ab4b90]:
    • effect@4.0.0-beta.62

4.0.0-beta.61

Patch Changes

4.0.0-beta.60

Patch Changes

4.0.0-beta.59

Patch Changes

  • Updated dependencies [56837ea]:
    • effect@4.0.0-beta.59

4.0.0-beta.58

Patch Changes

4.0.0-beta.57

Patch Changes

4.0.0-beta.56

Patch Changes

  • Updated dependencies []:
    • effect@4.0.0-beta.56

4.0.0-beta.55

Patch Changes

4.0.0-beta.54

Patch Changes

4.0.0-beta.53

Patch Changes

4.0.0-beta.52

Patch Changes

4.0.0-beta.51

Patch Changes

4.0.0-beta.50

Patch Changes

4.0.0-beta.49

Patch Changes

4.0.0-beta.48

Patch Changes

4.0.0-beta.47

Patch Changes

4.0.0-beta.46

Patch Changes

  • Updated dependencies [3a30b9e]:
    • effect@4.0.0-beta.46

4.0.0-beta.45

Patch Changes

  • Updated dependencies [5c3af6d]:
    • effect@4.0.0-beta.45

4.0.0-beta.44

Patch Changes

4.0.0-beta.43

Patch Changes

4.0.0-beta.42

Patch Changes

4.0.0-beta.41

Patch Changes

4.0.0-beta.40

Patch Changes

4.0.0-beta.39

Patch Changes

4.0.0-beta.38

Patch Changes

4.0.0-beta.37

Patch Changes

4.0.0-beta.36

Patch Changes

4.0.0-beta.35

Patch Changes

4.0.0-beta.34

Patch Changes

4.0.0-beta.33

Patch Changes

  • Updated dependencies [571447d]:
    • effect@4.0.0-beta.33

4.0.0-beta.32

Patch Changes

4.0.0-beta.31

Patch Changes

4.0.0-beta.30

Patch Changes

4.0.0-beta.29

Patch Changes

4.0.0-beta.28

Patch Changes

4.0.0-beta.27

Patch Changes

4.0.0-beta.26

Patch Changes

4.0.0-beta.25

Patch Changes

4.0.0-beta.24

Patch Changes

4.0.0-beta.23

Patch Changes

  • Updated dependencies [5c73c41]:
    • effect@4.0.0-beta.23

4.0.0-beta.22

Patch Changes

4.0.0-beta.21

Patch Changes

4.0.0-beta.20

Patch Changes

4.0.0-beta.19

Patch Changes

  • Updated dependencies []:
    • effect@4.0.0-beta.19

4.0.0-beta.18

Patch Changes

4.0.0-beta.17

Patch Changes

  • Updated dependencies [8f59c32]:
    • effect@4.0.0-beta.17

4.0.0-beta.16

Patch Changes

4.0.0-beta.15

Patch Changes

4.0.0-beta.14

Patch Changes

4.0.0-beta.13

Patch Changes

4.0.0-beta.12

Patch Changes

4.0.0-beta.11

Patch Changes

4.0.0-beta.10

Patch Changes

4.0.0-beta.9

Patch Changes

4.0.0-beta.8

Patch Changes

4.0.0-beta.7

Patch Changes

4.0.0-beta.6

Patch Changes

4.0.0-beta.5

Patch Changes

4.0.0-beta.4

Patch Changes

4.0.0-beta.3

Patch Changes

4.0.0-beta.2

Patch Changes

4.0.0-beta.1

Patch Changes

4.0.0-beta.0

Major Changes

Patch Changes

  • Updated dependencies [be642ab]:
    • effect@4.0.0-beta.0