effect-rstest 0.1.0 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Effect test helpers for [Rstest](https://rstest.rs). This package re-exports `@rstest/core` and adds Effect-aware tests, shared layers, test services, and property testing.
4
4
 
5
- This is an unofficial package adapted from [`@effect/vitest`](https://www.npmjs.com/package/@effect/vitest). There is an [open request](https://github.com/Effect-TS/effect/issues/8128) to add an official `@effect/rstest` package upstream.
6
-
7
5
  ## Installation
8
6
 
9
7
  ```sh
package/dist/index.js CHANGED
@@ -1,87 +1,183 @@
1
- /**
2
- * @since 0.1.0
3
- */
4
- import * as R from "@rstest/core";
5
- import * as internal from "./internal/internal.js";
6
- /**
7
- * @since 0.1.0
8
- */
1
+ import { flow, pipe } from "effect/Function";
2
+ import { FastCheck, TestClock, TestConsole } from "effect/testing";
9
3
  export * from "@rstest/core";
10
- /**
11
- * @since 0.1.0
12
- */
13
- export const addEqualityTesters = internal.addEqualityTesters;
14
- /**
15
- * @since 0.1.0
16
- */
17
- export const effect = internal.effect;
18
- /**
19
- * @since 0.1.0
20
- */
21
- export const live = internal.live;
22
- /**
23
- * Share a `Layer` between multiple tests, optionally wrapping
24
- * the tests in a `describe` block if a name is provided.
25
- *
26
- * Named layers accept `concurrent` to override inherited suite concurrency.
27
- * Anonymous layers always inherit the enclosing suite's concurrency.
28
- * Use `ctx.expect` in concurrent tests for test-local snapshots and assertion counts.
29
- *
30
- * @since 0.1.0
31
- *
32
- * ```ts
33
- * import { assert, layer } from "effect-rstest"
34
- * import { Effect, Layer, Context } from "effect"
35
- *
36
- * class Foo extends Context.Service<Foo, "foo">()("Foo") {
37
- * static layer = Layer.succeed(Foo, "foo")
38
- * }
39
- *
40
- * class Bar extends Context.Service<Bar, "bar">()("Bar") {
41
- * static layer = Layer.effect(
42
- * Bar,
43
- * Effect.map(Foo, () => "bar" as const)
44
- * )
45
- * }
46
- *
47
- * layer(Foo.layer)("layer", (it) => {
48
- * it.effect("adds context", () =>
49
- * Effect.gen(function*() {
50
- * const foo = yield* Foo
51
- * assert.strictEqual(foo, "foo")
52
- * }))
53
- *
54
- * it.layer(Bar.layer)("nested", (it) => {
55
- * it.effect("adds context", () =>
56
- * Effect.gen(function*() {
57
- * const foo = yield* Foo
58
- * const bar = yield* Bar
59
- * assert.strictEqual(foo, "foo")
60
- * assert.strictEqual(bar, "bar")
61
- * }))
62
- * })
63
- * })
64
- * ```
65
- */
66
- export const layer = internal.layer;
67
- /**
68
- * @since 0.1.0
69
- */
70
- export const flakyTest = internal.flakyTest;
71
- /**
72
- * @since 0.1.0
73
- */
74
- export const prop = internal.prop;
75
- /**
76
- * @since 0.1.0
77
- */
78
- export const it = internal.makeMethods(R.it);
79
- /**
80
- * @since 0.1.0
81
- */
82
- export const makeMethods = internal.makeMethods;
83
- /**
84
- * @since 0.1.0
85
- */
86
- export const describeWrapped = internal.describeWrapped;
4
+ import * as __rspack_external__rstest_core_d9441397 from "@rstest/core";
5
+ import * as __rspack_external_effect_Cause_2c757fc5 from "effect/Cause";
6
+ import * as __rspack_external_effect_Duration_69e466c3 from "effect/Duration";
7
+ import * as __rspack_external_effect_Effect_41060786 from "effect/Effect";
8
+ import * as __rspack_external_effect_Equal_84d564fb from "effect/Equal";
9
+ import * as __rspack_external_effect_Exit_1ca64b33 from "effect/Exit";
10
+ import * as __rspack_external_effect_Layer_69c46453 from "effect/Layer";
11
+ import * as __rspack_external_effect_Predicate_45f92690 from "effect/Predicate";
12
+ import * as __rspack_external_effect_Schedule_8bfd7ba9 from "effect/Schedule";
13
+ import * as __rspack_external_effect_Schema_6065f72d from "effect/Schema";
14
+ import * as __rspack_external_effect_Scope_f87b0bd6 from "effect/Scope";
15
+ const runPromise = __rspack_external_effect_Effect_41060786.fnUntraced(function*(effect, _ctx) {
16
+ const exit = yield* __rspack_external_effect_Effect_41060786.exit(effect);
17
+ if (__rspack_external_effect_Exit_1ca64b33.isFailure(exit)) {
18
+ const errors = __rspack_external_effect_Cause_2c757fc5.prettyErrors(exit.cause);
19
+ for(let i = 0; i < errors.length; i++)yield* __rspack_external_effect_Effect_41060786.logError(errors[i]);
20
+ }
21
+ return yield* exit;
22
+ }, (effect, _, ctx)=>__rspack_external_effect_Effect_41060786.runPromise(effect, {
23
+ signal: ctx?.signal
24
+ }));
25
+ const runTest = (ctx)=>(effect)=>runPromise(effect, ctx);
26
+ const TestEnv = __rspack_external_effect_Layer_69c46453.mergeAll(TestConsole.layer, TestClock.layer());
27
+ const addEqualityTesters = ()=>{
28
+ __rspack_external__rstest_core_d9441397.expect.addEqualityTesters([
29
+ (a, b)=>__rspack_external_effect_Equal_84d564fb.isEqual(a) || __rspack_external_effect_Equal_84d564fb.isEqual(b) ? __rspack_external_effect_Equal_84d564fb.equals(a, b) : void 0
30
+ ]);
31
+ };
32
+ const hookTimeout = (timeout)=>void 0 === timeout ? void 0 : __rspack_external_effect_Duration_69e466c3.toMillis(__rspack_external_effect_Duration_69e466c3.fromInputUnsafe(timeout));
33
+ const testOptions = (timeout)=>{
34
+ if ("number" == typeof timeout) return {
35
+ timeout
36
+ };
37
+ if (void 0 === timeout) return {};
38
+ const { fails: _, fastCheck: __, ...options } = timeout;
39
+ return options;
40
+ };
41
+ const propertyTestOptions = (timeout)=>"number" == typeof timeout ? void 0 : timeout;
42
+ const checkOptions = (timeout)=>propertyTestOptions(timeout)?.fastCheck;
43
+ const compileArbitraryInput = (input)=>__rspack_external_effect_Schema_6065f72d.isSchema(input) ? __rspack_external_effect_Schema_6065f72d.toArbitrary(input)(FastCheck) : input;
44
+ const makeArbitrary = (arbitraries)=>Array.isArray(arbitraries) ? FastCheck.tuple(...arbitraries.map(compileArbitraryInput)) : FastCheck.record(Object.fromEntries(Object.entries(arbitraries).map(([key, input])=>[
45
+ key,
46
+ compileArbitraryInput(input)
47
+ ])));
48
+ const normalizeProperty = (property, value)=>__rspack_external_effect_Effect_41060786.catchCause(__rspack_external_effect_Effect_41060786.suspend(()=>{
49
+ const output = property(value);
50
+ if (__rspack_external_effect_Predicate_45f92690.isPromiseLike(output)) throw new TypeError("Effect property tests must return an Effect or boolean");
51
+ return __rspack_external_effect_Effect_41060786.isEffect(output) ? output : __rspack_external_effect_Effect_41060786.succeed(output);
52
+ }), (cause)=>__rspack_external_effect_Cause_2c757fc5.hasInterrupts(cause) ? __rspack_external_effect_Effect_41060786.failCause(cause) : __rspack_external_effect_Effect_41060786.fail(cause));
53
+ const normalizeSyncProperty = (property, value, ctx)=>{
54
+ const output = property(value, ctx);
55
+ if (__rspack_external_effect_Predicate_45f92690.isPromiseLike(output)) throw new TypeError("Synchronous property tests must not return a Promise");
56
+ return false !== output;
57
+ };
58
+ const runCheck = (ctx, arbitrary, property, options)=>FastCheck.assert(FastCheck.asyncProperty(arbitrary, (value)=>runTest(ctx)(normalizeProperty(property, value))), options);
59
+ const makeItProxy = (it, overrides)=>new Proxy(it, {
60
+ apply (target, thisArg, argArray) {
61
+ return Reflect.apply(target, thisArg, argArray);
62
+ },
63
+ get (target, property, receiver) {
64
+ if (Object.hasOwn(overrides, property)) return Reflect.get(overrides, property);
65
+ return Reflect.get(target, property, receiver);
66
+ }
67
+ });
68
+ const makeTester = (mapEffect, it = __rspack_external__rstest_core_d9441397.it)=>{
69
+ const run = (ctx, args, self)=>pipe(__rspack_external_effect_Effect_41060786.suspend(()=>self(...args)), mapEffect, __rspack_external_effect_Effect_41060786.asVoid, runTest(ctx));
70
+ const f = (name, self, timeout)=>it(name, testOptions(timeout), (ctx)=>run(ctx, [
71
+ ctx
72
+ ], self));
73
+ const skip = (name, self, timeout)=>it.skip(name, testOptions(timeout), (ctx)=>run(ctx, [
74
+ ctx
75
+ ], self));
76
+ const skipIf = (condition)=>(name, self, timeout)=>it.skipIf(condition)(name, testOptions(timeout), (ctx)=>run(ctx, [
77
+ ctx
78
+ ], self));
79
+ const runIf = (condition)=>(name, self, timeout)=>it.runIf(condition)(name, testOptions(timeout), (ctx)=>run(ctx, [
80
+ ctx
81
+ ], self));
82
+ const only = (name, self, timeout)=>it.only(name, testOptions(timeout), (ctx)=>run(ctx, [
83
+ ctx
84
+ ], self));
85
+ const concurrent = (name, self, timeout)=>it.concurrent(name, testOptions(timeout), (ctx)=>run(ctx, [
86
+ ctx
87
+ ], self));
88
+ const sequential = (name, self, timeout)=>it.sequential(name, testOptions(timeout), (ctx)=>run(ctx, [
89
+ ctx
90
+ ], self));
91
+ const each = (cases)=>(name, self, timeout)=>{
92
+ it.for(cases)(name, testOptions(timeout), (args, ctx)=>run(ctx, [
93
+ args
94
+ ], self));
95
+ };
96
+ const fails = (name, self, timeout)=>it.fails(name, testOptions(timeout), (ctx)=>run(ctx, [
97
+ ctx
98
+ ], self));
99
+ const prop = (name, arbitraries, self, timeout)=>{
100
+ const arbitrary = makeArbitrary(arbitraries);
101
+ const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it;
102
+ return testApi(name, testOptions(timeout), (ctx)=>runCheck(ctx, arbitrary, (values)=>__rspack_external_effect_Effect_41060786.mapEager(mapEffect(__rspack_external_effect_Effect_41060786.suspend(()=>self(values, ctx))), (value)=>false !== value), checkOptions(timeout)));
103
+ };
104
+ return Object.assign(f, {
105
+ skip,
106
+ skipIf,
107
+ runIf,
108
+ only,
109
+ concurrent,
110
+ sequential,
111
+ each,
112
+ fails,
113
+ prop
114
+ });
115
+ };
116
+ const makeProp = (it)=>(name, arbitraries, self, timeout)=>{
117
+ const arbitrary = makeArbitrary(arbitraries);
118
+ const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it;
119
+ return testApi(name, testOptions(timeout), (ctx)=>runCheck(ctx, arbitrary, (values)=>normalizeSyncProperty(self, values, ctx), checkOptions(timeout)));
120
+ };
121
+ const internal_prop = makeProp(__rspack_external__rstest_core_d9441397.it);
122
+ const internal_layer = (layer_, options, testApi = __rspack_external__rstest_core_d9441397.it)=>(...args)=>{
123
+ const excludeTestServices = options?.excludeTestServices ?? false;
124
+ const withTestEnv = excludeTestServices ? layer_ : __rspack_external_effect_Layer_69c46453.provideMerge(layer_, TestEnv);
125
+ const memoMap = options?.memoMap ?? __rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Layer_69c46453.makeMemoMap);
126
+ const scope = __rspack_external_effect_Effect_41060786.runSync(__rspack_external_effect_Scope_f87b0bd6.make());
127
+ const contextEffect = __rspack_external_effect_Layer_69c46453.buildWithMemoMap(withTestEnv, memoMap, scope).pipe(__rspack_external_effect_Effect_41060786.orDie, __rspack_external_effect_Effect_41060786.cached, __rspack_external_effect_Effect_41060786.runSync);
128
+ let closePromise;
129
+ const closeScope = ()=>{
130
+ if (void 0 !== closePromise) return closePromise;
131
+ closePromise = runPromise(__rspack_external_effect_Scope_f87b0bd6.close(scope, __rspack_external_effect_Exit_1ca64b33["void"])).then(()=>{});
132
+ return closePromise;
133
+ };
134
+ const makeIt = (it)=>makeItProxy(it, {
135
+ effect: makeTester((effect)=>__rspack_external_effect_Effect_41060786.flatMap(contextEffect, (context)=>effect.pipe(__rspack_external_effect_Effect_41060786.scoped, __rspack_external_effect_Effect_41060786.provide(context))), it),
136
+ prop: makeProp(it),
137
+ flakyTest: flakyTest,
138
+ layer (nestedLayer, options) {
139
+ return internal_layer(__rspack_external_effect_Layer_69c46453.provideMerge(nestedLayer, withTestEnv), {
140
+ ...options,
141
+ memoMap: __rspack_external_effect_Layer_69c46453.forkMemoMapUnsafe(memoMap),
142
+ excludeTestServices
143
+ }, it);
144
+ }
145
+ });
146
+ if (1 === args.length) {
147
+ const timeout = hookTimeout(options?.timeout);
148
+ return __rspack_external__rstest_core_d9441397.describe("", ()=>{
149
+ __rspack_external__rstest_core_d9441397.beforeAll(()=>runPromise(__rspack_external_effect_Effect_41060786.asVoid(contextEffect)), timeout);
150
+ __rspack_external__rstest_core_d9441397.afterAll(()=>closeScope(), timeout);
151
+ return args[0](makeIt(testApi));
152
+ });
153
+ }
154
+ const describe = options?.concurrent === true ? __rspack_external__rstest_core_d9441397.describe.concurrent : options?.concurrent === false ? __rspack_external__rstest_core_d9441397.describe.sequential : __rspack_external__rstest_core_d9441397.describe;
155
+ return describe(args[0], ()=>{
156
+ __rspack_external__rstest_core_d9441397.beforeAll(()=>runPromise(__rspack_external_effect_Effect_41060786.asVoid(contextEffect)), hookTimeout(options?.timeout));
157
+ __rspack_external__rstest_core_d9441397.afterAll(()=>closeScope(), hookTimeout(options?.timeout));
158
+ return args[1](makeIt(testApi));
159
+ });
160
+ };
161
+ const makeLayer = (it)=>(layer_, options)=>internal_layer(layer_, options, it);
162
+ const flakyTest = (self, timeout = __rspack_external_effect_Duration_69e466c3.seconds(30))=>pipe(self, __rspack_external_effect_Effect_41060786.scoped, __rspack_external_effect_Effect_41060786.sandbox, __rspack_external_effect_Effect_41060786.retry(pipe(__rspack_external_effect_Schedule_8bfd7ba9.recurs(10), __rspack_external_effect_Schedule_8bfd7ba9["while"]((_)=>__rspack_external_effect_Effect_41060786.succeed(__rspack_external_effect_Duration_69e466c3.isLessThanOrEqualTo(__rspack_external_effect_Duration_69e466c3.fromInputUnsafe(_.elapsed), __rspack_external_effect_Duration_69e466c3.fromInputUnsafe(timeout)))))), __rspack_external_effect_Effect_41060786.orDie);
163
+ const makeMethods = (it)=>makeItProxy(it, {
164
+ effect: makeTester(flow(__rspack_external_effect_Effect_41060786.scoped, __rspack_external_effect_Effect_41060786.provide(TestEnv)), it),
165
+ live: makeTester(__rspack_external_effect_Effect_41060786.scoped, it),
166
+ flakyTest: flakyTest,
167
+ layer: makeLayer(it),
168
+ prop: makeProp(it)
169
+ });
170
+ const { effect: internal_effect, live: live } = makeMethods(__rspack_external__rstest_core_d9441397.it);
171
+ const describeWrapped = (name, f)=>__rspack_external__rstest_core_d9441397.describe(name, ()=>f(makeMethods(__rspack_external__rstest_core_d9441397.it)));
172
+ const src_addEqualityTesters = addEqualityTesters;
173
+ const src_effect = internal_effect;
174
+ const src_live = live;
175
+ const src_layer = internal_layer;
176
+ const src_flakyTest = flakyTest;
177
+ const src_prop = internal_prop;
178
+ const src_it = makeMethods(__rspack_external__rstest_core_d9441397.it);
179
+ const src_makeMethods = makeMethods;
180
+ const src_describeWrapped = describeWrapped;
181
+ export { src_addEqualityTesters as addEqualityTesters, src_describeWrapped as describeWrapped, src_effect as effect, src_flakyTest as flakyTest, src_it as it, src_layer as layer, src_live as live, src_makeMethods as makeMethods, src_prop as prop };
182
+
87
183
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAOjC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAElD;;GAEG;AACH,cAAc,cAAc,CAAA;AAyK5B;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAe,QAAQ,CAAC,kBAAkB,CAAA;AAEzE;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAA+B,QAAQ,CAAC,MAAM,CAAA;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAA+B,QAAQ,CAAC,IAAI,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,MAAM,KAAK,GAWd,QAAQ,CAAC,KAAK,CAAA;AAElB;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAGY,QAAQ,CAAC,SAAS,CAAA;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAA2B,QAAQ,CAAC,IAAI,CAAA;AAEzD;;GAEG;AACH,MAAM,CAAC,MAAM,EAAE,GAAmB,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAA4D,QAAQ,CAAC,WAAW,CAAA;AAExG;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4D,QAAQ,CAAC,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sources":["../src/internal/internal.ts","../src/index.ts"],"sourcesContent":["/**\n * @since 0.1.0\n */\n\nimport * as R from \"@rstest/core\"\nimport * as Cause from \"effect/Cause\"\nimport * as Duration from \"effect/Duration\"\nimport * as Effect from \"effect/Effect\"\nimport * as Equal from \"effect/Equal\"\nimport * as Exit from \"effect/Exit\"\nimport { flow, pipe } from \"effect/Function\"\nimport * as Layer from \"effect/Layer\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Schedule from \"effect/Schedule\"\nimport * as Schema from \"effect/Schema\"\nimport * as Scope from \"effect/Scope\"\nimport { FastCheck as FC, TestClock, TestConsole } from \"effect/testing\"\nimport type * as Rstest from \"../index.ts\"\n\nconst runPromise: <E, A>(\n _: Effect.Effect<A, E, never>,\n ctx?: R.TestContext | undefined\n) => Promise<A> = Effect.fnUntraced(function*<E, A>(effect: Effect.Effect<A, E>, _ctx?: Rstest.TestContext) {\n const exit = yield* Effect.exit(effect)\n if (Exit.isFailure(exit)) {\n const errors = Cause.prettyErrors(exit.cause)\n for (let i = 0; i < errors.length; i++) {\n yield* Effect.logError(errors[i])\n }\n }\n return yield* exit\n}, (effect, _, ctx) => Effect.runPromise(effect, { signal: ctx?.signal }))\n\n/** @internal */\nconst runTest = (ctx?: Rstest.TestContext) => <E, A>(effect: Effect.Effect<A, E>) => runPromise(effect, ctx)\n\n/** @internal */\nexport type TestContext = TestConsole.TestConsole | TestClock.TestClock\n\nconst TestEnv = Layer.mergeAll(TestConsole.layer, TestClock.layer())\n\n/** @internal */\nexport const addEqualityTesters = () => {\n R.expect.addEqualityTesters([\n (a, b) => Equal.isEqual(a) || Equal.isEqual(b) ? Equal.equals(a, b) : undefined\n ])\n}\n\nconst hookTimeout = (timeout?: Duration.Input) =>\n timeout === undefined ? undefined : Duration.toMillis(Duration.fromInputUnsafe(timeout))\n\ntype PropertyOptions = R.TestOptions & {\n readonly fastCheck?: FC.Parameters<any> | undefined\n readonly fails?: boolean | undefined\n}\n\ntype PropertyTimeout = number | PropertyOptions\n\n/** @internal */\nconst testOptions = (timeout?: number | R.TestOptions | PropertyOptions): R.TestOptions => {\n if (typeof timeout === \"number\") {\n return { timeout }\n }\n if (timeout === undefined) {\n return {}\n }\n const { fails: _, fastCheck: __, ...options } = timeout as PropertyOptions\n return options\n}\n\ntype ArbitraryInput = Schema.Schema<any> | FC.Arbitrary<unknown>\n\ntype Arbitraries = ReadonlyArray<ArbitraryInput> | { [K in string]: ArbitraryInput }\n\nconst propertyTestOptions = (\n timeout: PropertyTimeout | undefined\n): Exclude<PropertyTimeout, number> | undefined => typeof timeout === \"number\" ? undefined : timeout\n\nconst checkOptions = (timeout: PropertyTimeout | undefined): FC.Parameters<any> | undefined =>\n propertyTestOptions(timeout)?.fastCheck\n\nconst compileArbitraryInput = (input: ArbitraryInput): FC.Arbitrary<any> =>\n Schema.isSchema(input) ? Schema.toArbitrary(input)(FC) : input as FC.Arbitrary<any>\n\nconst makeArbitrary = (arbitraries: Arbitraries): FC.Arbitrary<any> =>\n Array.isArray(arbitraries)\n ? FC.tuple(...arbitraries.map(compileArbitraryInput))\n : FC.record(Object.fromEntries(\n Object.entries(arbitraries).map(([key, input]) => [key, compileArbitraryInput(input)])\n ))\n\nconst normalizeProperty = <A, E, R>(\n property: (value: A) => boolean | Effect.Effect<boolean, E, R>,\n value: A\n): Effect.Effect<boolean, E | Cause.Cause<E>, R> =>\n Effect.catchCause(\n Effect.suspend(() => {\n const output = property(value)\n if (Predicate.isPromiseLike(output)) {\n throw new TypeError(\"Effect property tests must return an Effect or boolean\")\n }\n return Effect.isEffect(output) ? output : Effect.succeed(output)\n }),\n (cause): Effect.Effect<never, E | Cause.Cause<E>> =>\n Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.fail(cause)\n )\n\nconst normalizeSyncProperty = <A>(\n property: (value: A, ctx: R.TestContext) => boolean | void,\n value: A,\n ctx: R.TestContext\n): boolean => {\n const output = property(value, ctx)\n if (Predicate.isPromiseLike(output)) {\n throw new TypeError(\"Synchronous property tests must not return a Promise\")\n }\n return output !== false\n}\n\nconst runCheck = <A, E>(\n ctx: R.TestContext,\n arbitrary: FC.Arbitrary<A>,\n property: (value: A) => boolean | Effect.Effect<boolean, E>,\n options: FC.Parameters<any> | undefined\n): Promise<void> =>\n FC.assert(\n FC.asyncProperty(arbitrary, (value) => runTest(ctx)(normalizeProperty(property, value))),\n options\n )\n\ntype TestAPI = R.TestAPIs | R.TestAPIs[\"skip\"]\n\nconst makeItProxy = <Methods extends object>(\n it: TestAPI,\n overrides: Methods\n): Methods & R.TestAPIs =>\n new Proxy(it as Methods & R.TestAPIs, {\n apply(target, thisArg, argArray) {\n return Reflect.apply(target, thisArg, argArray)\n },\n get(target, property, receiver) {\n if (Object.hasOwn(overrides, property)) {\n return Reflect.get(overrides, property)\n }\n // do not bind: binding would strip Rstest's static helpers\n return Reflect.get(target, property, receiver)\n }\n })\n\n/** @internal */\nconst makeTester = <R>(\n mapEffect: <A, E>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, never>,\n it: TestAPI = R.it\n): Rstest.Rstest.Tester<R> => {\n const run = <A, E, TestArgs extends Array<unknown>>(\n ctx: R.TestContext & object,\n args: TestArgs,\n self: Rstest.Rstest.TestFunction<A, E, R, TestArgs>\n ) => pipe(Effect.suspend(() => self(...args)), mapEffect, Effect.asVoid, runTest(ctx))\n\n const f: Rstest.Rstest.Test<R> = (name, self, timeout) =>\n it(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const skip: Rstest.Rstest.Tester<R>[\"only\"] = (name, self, timeout) =>\n it.skip(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const skipIf: Rstest.Rstest.Tester<R>[\"skipIf\"] = (condition) => (name, self, timeout) =>\n it.skipIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const runIf: Rstest.Rstest.Tester<R>[\"runIf\"] = (condition) => (name, self, timeout) =>\n it.runIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const only: Rstest.Rstest.Tester<R>[\"only\"] = (name, self, timeout) =>\n it.only(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const concurrent: Rstest.Rstest.Tester<R>[\"concurrent\"] = (name, self, timeout) =>\n it.concurrent(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const sequential: Rstest.Rstest.Tester<R>[\"sequential\"] = (name, self, timeout) =>\n it.sequential(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const each: Rstest.Rstest.Tester<R>[\"each\"] = (cases) => (name, self, timeout) => {\n it.for(cases)(\n name,\n testOptions(timeout),\n (args, ctx) => run(ctx, [args], self)\n )\n }\n\n const fails: Rstest.Rstest.Tester<R>[\"fails\"] = (name, self, timeout) =>\n it.fails(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self))\n\n const prop: Rstest.Rstest.Tester<R>[\"prop\"] = (name, arbitraries, self, timeout) => {\n const arbitrary = makeArbitrary(arbitraries)\n const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it\n return testApi(\n name,\n testOptions(timeout),\n (ctx) =>\n runCheck(\n ctx,\n arbitrary,\n (values) =>\n Effect.mapEager(\n mapEffect(Effect.suspend(() => self(values as any, ctx))),\n (value) => (value as unknown) !== false\n ),\n checkOptions(timeout)\n )\n )\n }\n\n return Object.assign(f, { skip, skipIf, runIf, only, concurrent, sequential, each, fails, prop })\n}\n\n/** @internal */\nconst makeProp = (it: TestAPI): Rstest.Rstest.Methods[\"prop\"] => (name, arbitraries, self, timeout) => {\n const arbitrary = makeArbitrary(arbitraries)\n const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it\n return testApi(\n name,\n testOptions(timeout),\n (ctx) =>\n runCheck(\n ctx,\n arbitrary,\n (values) => normalizeSyncProperty(self, values as any, ctx),\n checkOptions(timeout)\n )\n )\n}\n\n/** @internal */\nexport const prop: Rstest.Rstest.Methods[\"prop\"] = makeProp(R.it)\n\n/** @internal */\nexport const layer = <R, E>(\n layer_: Layer.Layer<R, E>,\n options?: {\n readonly concurrent?: boolean\n readonly memoMap?: Layer.MemoMap\n readonly timeout?: Duration.Input\n readonly excludeTestServices?: boolean\n },\n testApi: TestAPI = R.it\n): {\n (f: (it: Rstest.Rstest.MethodsNonLive<R>) => void): void\n (\n name: string,\n f: (it: Rstest.Rstest.MethodsNonLive<R>) => void\n ): void\n} =>\n(\n ...args: [\n name: string,\n f: (\n it: Rstest.Rstest.MethodsNonLive<R>\n ) => void\n ] | [\n f: (it: Rstest.Rstest.MethodsNonLive<R>) => void\n ]\n) => {\n const excludeTestServices = options?.excludeTestServices ?? false\n const withTestEnv = excludeTestServices\n ? layer_ as Layer.Layer<R, E>\n : Layer.provideMerge(layer_, TestEnv)\n const memoMap = options?.memoMap ?? Effect.runSync(Layer.makeMemoMap)\n const scope = Effect.runSync(Scope.make())\n const contextEffect = Layer.buildWithMemoMap(withTestEnv, memoMap, scope).pipe(\n Effect.orDie,\n Effect.cached,\n Effect.runSync\n )\n let closePromise: Promise<void> | undefined\n const closeScope = (): Promise<void> => {\n if (closePromise !== undefined) {\n return closePromise\n }\n closePromise = runPromise(Scope.close(scope, Exit.void)).then(() => {})\n return closePromise\n }\n\n const makeIt = (it: TestAPI): Rstest.Rstest.MethodsNonLive<R> =>\n makeItProxy(it, {\n effect: makeTester<R | Scope.Scope>(\n (effect) =>\n Effect.flatMap(contextEffect, (context) =>\n effect.pipe(\n Effect.scoped,\n Effect.provide(context)\n )),\n it\n ),\n prop: makeProp(it),\n flakyTest,\n layer<R2, E2>(nestedLayer: Layer.Layer<R2, E2, R>, options?: {\n readonly concurrent?: boolean\n readonly timeout?: Duration.Input\n }) {\n return layer(\n Layer.provideMerge(nestedLayer, withTestEnv),\n {\n ...options,\n memoMap: Layer.forkMemoMapUnsafe(memoMap),\n excludeTestServices\n },\n it\n )\n }\n })\n\n if (args.length === 1) {\n const timeout = hookTimeout(options?.timeout)\n return R.describe(\"\", () => {\n R.beforeAll(() => runPromise(Effect.asVoid(contextEffect)), timeout)\n R.afterAll(() => closeScope(), timeout)\n return args[0](makeIt(testApi))\n })\n }\n\n const describe = options?.concurrent === true\n ? R.describe.concurrent\n : options?.concurrent === false\n ? R.describe.sequential\n : R.describe\n return describe(args[0], () => {\n R.beforeAll(\n () => runPromise(Effect.asVoid(contextEffect)),\n hookTimeout(options?.timeout)\n )\n R.afterAll(\n () => closeScope(),\n hookTimeout(options?.timeout)\n )\n return args[1](makeIt(testApi))\n })\n}\n\nconst makeLayer = (it: TestAPI): Rstest.Rstest.Methods[\"layer\"] => (layer_, options) => layer(layer_, options, it)\n\n/** @internal */\nexport const flakyTest = <A, E, R>(\n self: Effect.Effect<A, E, R | Scope.Scope>,\n timeout: Duration.Input = Duration.seconds(30)\n) =>\n pipe(\n self,\n Effect.scoped,\n Effect.sandbox,\n Effect.retry(\n pipe(\n Schedule.recurs(10),\n Schedule.while((_) =>\n Effect.succeed(Duration.isLessThanOrEqualTo(\n Duration.fromInputUnsafe(_.elapsed),\n Duration.fromInputUnsafe(timeout)\n ))\n )\n )\n ),\n Effect.orDie\n )\n\n/** @internal */\nexport const makeMethods = (it: TestAPI): Rstest.Rstest.Methods =>\n makeItProxy(it, {\n effect: makeTester<Scope.Scope>(flow(Effect.scoped, Effect.provide(TestEnv)), it),\n live: makeTester<Scope.Scope>(Effect.scoped, it),\n flakyTest,\n layer: makeLayer(it),\n prop: makeProp(it)\n })\n\n/** @internal */\nexport const {\n /** @internal */\n effect,\n /** @internal */\n live\n} = makeMethods(R.it)\n\n/** @internal */\nexport const describeWrapped = (name: string, f: (it: Rstest.Rstest.Methods) => void): void =>\n R.describe(name, () => f(makeMethods(R.it)))\n","/**\n * @since 0.1.0\n */\nimport * as R from \"@rstest/core\"\nimport type * as Duration from \"effect/Duration\"\nimport type * as Effect from \"effect/Effect\"\nimport type * as Layer from \"effect/Layer\"\nimport type * as Schema from \"effect/Schema\"\nimport type * as Scope from \"effect/Scope\"\nimport type { FastCheck as FC } from \"effect/testing\"\nimport * as internal from \"./internal/internal.ts\"\n\n/**\n * @since 0.1.0\n */\nexport * from \"@rstest/core\"\n\n/**\n * @since 0.1.0\n */\nexport type API = R.TestAPIs\n\n/**\n * @since 0.1.0\n */\nexport namespace Rstest {\n /**\n * @since 0.1.0\n */\n export interface TestFunction<A, E, R, TestArgs extends Array<any>> {\n (...args: TestArgs): Effect.Effect<A, E, R>\n }\n\n /**\n * @since 0.1.0\n */\n export interface Test<R> {\n <A, E>(\n name: string,\n self: TestFunction<A, E, R, [R.TestContext]>,\n timeout?: number | R.TestOptions\n ): void\n }\n\n /**\n * @since 0.1.0\n */\n export type Arbitraries =\n | ReadonlyArray<Schema.Schema<any> | FC.Arbitrary<any>>\n | { [K in string]: Schema.Schema<any> | FC.Arbitrary<any> }\n\n type ArbitraryValue<A> = A extends Schema.Schema<infer T> ? T\n : A extends FC.Arbitrary<infer T> ? T\n : never\n\n /**\n * @since 0.1.0\n */\n export interface Tester<R> extends Rstest.Test<R> {\n skip: Rstest.Test<R>\n skipIf: (condition: boolean) => Rstest.Test<R>\n runIf: (condition: boolean) => Rstest.Test<R>\n only: Rstest.Test<R>\n concurrent: Rstest.Test<R>\n sequential: Rstest.Test<R>\n each: <T>(\n cases: ReadonlyArray<T>\n ) => <A, E>(name: string, self: TestFunction<A, E, R, [T]>, timeout?: number | R.TestOptions) => void\n fails: Rstest.Test<R>\n\n /**\n * Runs an Effectful property test using Schema or Arbitrary inputs.\n *\n * **Details**\n *\n * Returning `false` or completing with any non-interruption failure falsifies the property and triggers shrinking.\n * This includes typed Effect failures, thrown exceptions, interruptions, and defects such as failed assertions.\n *\n * The Rstest timeout interrupts the Effect fiber running generation, property evaluation, and shrinking. Effect\n * finalizers run during that interruption.\n *\n * **Gotchas**\n *\n * A timeout cannot preempt a synchronous JavaScript callback that does not return.\n *\n * @since 0.1.0\n */\n prop: <const Arbs extends Arbitraries, A, E>(\n name: string,\n arbitraries: Arbs,\n self: TestFunction<\n A,\n E,\n R,\n [\n {\n [K in keyof Arbs]: ArbitraryValue<Arbs[K]>\n },\n R.TestContext\n ]\n >,\n timeout?:\n | number\n | R.TestOptions & {\n fastCheck?: FC.Parameters<any>\n fails?: boolean\n }\n ) => void\n }\n\n /**\n * @since 0.1.0\n */\n export interface MethodsNonLive<R = never> extends API {\n readonly effect: Rstest.Tester<R | Scope.Scope>\n readonly flakyTest: <A, E, R2>(\n self: Effect.Effect<A, E, R2 | Scope.Scope>,\n timeout?: Duration.Input\n ) => Effect.Effect<A, never, R2>\n readonly layer: <R2, E>(layer: Layer.Layer<R2, E, R>, options?: {\n readonly concurrent?: boolean\n readonly timeout?: Duration.Input\n }) => {\n (f: (it: Rstest.MethodsNonLive<R | R2>) => void): void\n (\n name: string,\n f: (it: Rstest.MethodsNonLive<R | R2>) => void\n ): void\n }\n\n /**\n * Runs a synchronous property test using Schema or Arbitrary inputs.\n *\n * **Details**\n *\n * Returning `false` or throwing falsifies the property and triggers shrinking. A callback that returns normally\n * without returning `false` passes for that generated input.\n *\n * The Rstest timeout interrupts the Effect fiber running generation and shrinking.\n *\n * **Gotchas**\n *\n * A timeout cannot preempt a synchronous JavaScript callback that does not return.\n *\n * @since 0.1.0\n */\n readonly prop: <const Arbs extends Arbitraries>(\n name: string,\n arbitraries: Arbs,\n self: (\n properties: {\n [K in keyof Arbs]: ArbitraryValue<Arbs[K]>\n },\n ctx: R.TestContext\n ) => boolean | void,\n timeout?:\n | number\n | R.TestOptions & {\n fastCheck?: FC.Parameters<any>\n fails?: boolean\n }\n ) => void\n }\n\n /**\n * @since 0.1.0\n */\n export interface Methods<R = never> extends MethodsNonLive<R> {\n readonly live: Rstest.Tester<Scope.Scope | R>\n readonly layer: <R2, E>(layer: Layer.Layer<R2, E, R>, options?: {\n readonly concurrent?: boolean\n readonly memoMap?: Layer.MemoMap\n readonly timeout?: Duration.Input\n readonly excludeTestServices?: boolean\n }) => {\n (f: (it: Rstest.MethodsNonLive<R | R2>) => void): void\n (\n name: string,\n f: (it: Rstest.MethodsNonLive<R | R2>) => void\n ): void\n }\n }\n}\n\n/**\n * @since 0.1.0\n */\nexport const addEqualityTesters: () => void = internal.addEqualityTesters\n\n/**\n * @since 0.1.0\n */\nexport const effect: Rstest.Tester<Scope.Scope> = internal.effect\n\n/**\n * @since 0.1.0\n */\nexport const live: Rstest.Tester<Scope.Scope> = internal.live\n\n/**\n * Share a `Layer` between multiple tests, optionally wrapping\n * the tests in a `describe` block if a name is provided.\n *\n * Named layers accept `concurrent` to override inherited suite concurrency.\n * Anonymous layers always inherit the enclosing suite's concurrency.\n * Use `ctx.expect` in concurrent tests for test-local snapshots and assertion counts.\n *\n * @since 0.1.0\n *\n * ```ts\n * import { assert, layer } from \"effect-rstest\"\n * import { Effect, Layer, Context } from \"effect\"\n *\n * class Foo extends Context.Service<Foo, \"foo\">()(\"Foo\") {\n * static layer = Layer.succeed(Foo, \"foo\")\n * }\n *\n * class Bar extends Context.Service<Bar, \"bar\">()(\"Bar\") {\n * static layer = Layer.effect(\n * Bar,\n * Effect.map(Foo, () => \"bar\" as const)\n * )\n * }\n *\n * layer(Foo.layer)(\"layer\", (it) => {\n * it.effect(\"adds context\", () =>\n * Effect.gen(function*() {\n * const foo = yield* Foo\n * assert.strictEqual(foo, \"foo\")\n * }))\n *\n * it.layer(Bar.layer)(\"nested\", (it) => {\n * it.effect(\"adds context\", () =>\n * Effect.gen(function*() {\n * const foo = yield* Foo\n * const bar = yield* Bar\n * assert.strictEqual(foo, \"foo\")\n * assert.strictEqual(bar, \"bar\")\n * }))\n * })\n * })\n * ```\n */\nexport const layer: <R, E>(\n layer_: Layer.Layer<R, E>,\n options?: {\n readonly concurrent?: boolean\n readonly memoMap?: Layer.MemoMap\n readonly timeout?: Duration.Input\n readonly excludeTestServices?: boolean\n }\n) => {\n (f: (it: Rstest.MethodsNonLive<R>) => void): void\n (name: string, f: (it: Rstest.MethodsNonLive<R>) => void): void\n} = internal.layer\n\n/**\n * @since 0.1.0\n */\nexport const flakyTest: <A, E, R>(\n self: Effect.Effect<A, E, R | Scope.Scope>,\n timeout?: Duration.Input\n) => Effect.Effect<A, never, R> = internal.flakyTest\n\n/**\n * @since 0.1.0\n */\nexport const prop: Rstest.Methods[\"prop\"] = internal.prop\n\n/**\n * @since 0.1.0\n */\nexport const it: Rstest.Methods = internal.makeMethods(R.it)\n\n/**\n * @since 0.1.0\n */\nexport const makeMethods: (it: R.TestAPIs | R.TestAPIs[\"skip\"]) => Rstest.Methods = internal.makeMethods\n\n/**\n * @since 0.1.0\n */\nexport const describeWrapped: (name: string, f: (it: Rstest.Methods) => void) => void = internal.describeWrapped\n"],"names":["runPromise","Effect","effect","_ctx","exit","Exit","errors","Cause","i","_","ctx","runTest","TestEnv","Layer","TestConsole","TestClock","addEqualityTesters","R","a","b","Equal","undefined","hookTimeout","timeout","Duration","testOptions","__","options","propertyTestOptions","checkOptions","compileArbitraryInput","input","Schema","FC","makeArbitrary","arbitraries","Array","Object","key","normalizeProperty","property","value","output","Predicate","TypeError","cause","normalizeSyncProperty","runCheck","arbitrary","makeItProxy","it","overrides","Proxy","target","thisArg","argArray","Reflect","receiver","makeTester","mapEffect","run","args","self","pipe","f","name","skip","skipIf","condition","runIf","only","concurrent","sequential","each","cases","fails","prop","testApi","values","makeProp","layer","layer_","excludeTestServices","withTestEnv","memoMap","scope","Scope","contextEffect","closePromise","closeScope","makeIt","context","flakyTest","nestedLayer","describe","makeLayer","Schedule","makeMethods","flow","live","describeWrapped","internal"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAMA,aAGYC,yCAAAA,UAAiB,CAAC,UAAgBC,MAA2B,EAAEC,IAAyB;IACxG,MAAMC,OAAO,OAAOH,yCAAAA,IAAW,CAACC;IAChC,IAAIG,uCAAAA,SAAc,CAACD,OAAO;QACxB,MAAME,SAASC,wCAAAA,YAAkB,CAACH,KAAK,KAAK;QAC5C,IAAK,IAAII,IAAI,GAAG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AACgD,MAAM,IAAMD,EAAEiC,YAAYhF,wCAAAA,EAAI;ACpMpC,MAAMD,yBAAiCqF;AAKvC,MAAMnG,aAAqCmG;AAK3C,MAAMF,WAAmCE;AA8CzC,MAAMrB,YAWTqB;AAKG,MAAMT,gBAGqBS;AAK3B,MAAMzB,WAA+ByB;AAKrC,MAAMnD,SAAqBmD,YAAqBpF,wCAAAA,EAAI;AAKpD,MAAMgF,kBAAuEI;AAK7E,MAAMD,sBAA2EC"}
@@ -7,7 +7,7 @@ import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
8
8
  import * as Scope from "effect/Scope";
9
9
  import { TestClock, TestConsole } from "effect/testing";
10
- import type * as Rstest from "../index.ts";
10
+ import type * as Rstest from "../index.js";
11
11
  /** @internal */
12
12
  export type TestContext = TestConsole.TestConsole | TestClock.TestClock;
13
13
  /** @internal */
package/dist/utils.js CHANGED
@@ -1,257 +1,94 @@
1
- /**
2
- * Provides assertion helpers used by `effect-rstest` tests.
3
- *
4
- * This module defines small assertion functions built on Node's `assert`,
5
- * Rstest's instance checks, and Effect's equality support. The helpers cover
6
- * basic equality, thrown errors, defined and undefined values, strings, regular
7
- * expressions, class instances, `Option`, `Result`, and `Exit`. Most helpers are
8
- * synchronous; `throwsAsync` handles rejected promises.
9
- *
10
- * @since 0.1.0
11
- */
12
- import { assert as rassert } from "@rstest/core";
13
- import * as Equal from "effect/Equal";
14
- import * as Exit from "effect/Exit";
15
- import * as Option from "effect/Option";
16
- import * as Predicate from "effect/Predicate";
17
- import * as Result from "effect/Result";
18
- import * as assert from "node:assert";
19
- /**
20
- * Fails the current test with the provided error message.
21
- *
22
- * @category testing
23
- * @since 0.1.0
24
- */
25
- export function fail(message) {
26
- assert.fail(message);
27
- }
28
- /**
29
- * Asserts that `actual` is deeply strictly equal to `expected` using Node's `assert.deepStrictEqual`.
30
- *
31
- * @category testing
32
- * @since 0.1.0
33
- */
34
- export function deepStrictEqual(actual, expected, message, ..._) {
35
- assert.deepStrictEqual(actual, expected, message);
36
- }
37
- /**
38
- * Asserts that `actual` is not deeply strictly equal to `expected` using Node's `assert.notDeepStrictEqual`.
39
- *
40
- * @category testing
41
- * @since 0.1.0
42
- */
43
- export function notDeepStrictEqual(actual, expected, message, ..._) {
44
- assert.notDeepStrictEqual(actual, expected, message);
45
- }
46
- /**
47
- * Asserts that `actual` is strictly equal to `expected` using Node's `assert.strictEqual`.
48
- *
49
- * @category testing
50
- * @since 0.1.0
51
- */
52
- export function strictEqual(actual, expected, message, ..._) {
53
- if (message !== undefined) {
54
- assert.strictEqual(actual, expected, message);
55
- }
56
- else {
57
- assert.strictEqual(actual, expected);
58
- }
59
- }
60
- /**
61
- * Asserts that `actual` is equal to `expected` using the `Equal.equals` trait.
62
- *
63
- * @category testing
64
- * @since 0.1.0
65
- */
66
- export function assertEquals(actual, expected, message, ..._) {
67
- if (!Equal.equals(actual, expected)) {
68
- deepStrictEqual(actual, expected, message); // show diff
1
+ import { assert } from "@rstest/core";
2
+ import * as __rspack_external_effect_Equal_84d564fb from "effect/Equal";
3
+ import * as __rspack_external_effect_Exit_1ca64b33 from "effect/Exit";
4
+ import * as __rspack_external_effect_Option_0498e63a from "effect/Option";
5
+ import * as __rspack_external_effect_Predicate_45f92690 from "effect/Predicate";
6
+ import * as __rspack_external_effect_Result_92419af5 from "effect/Result";
7
+ import * as __rspack_external_node_assert_a4deaa5d from "node:assert";
8
+ function fail(message) {
9
+ __rspack_external_node_assert_a4deaa5d.fail(message);
10
+ }
11
+ function deepStrictEqual(actual, expected, message) {
12
+ __rspack_external_node_assert_a4deaa5d.deepStrictEqual(actual, expected, message);
13
+ }
14
+ function notDeepStrictEqual(actual, expected, message) {
15
+ __rspack_external_node_assert_a4deaa5d.notDeepStrictEqual(actual, expected, message);
16
+ }
17
+ function strictEqual(actual, expected, message) {
18
+ if (void 0 !== message) __rspack_external_node_assert_a4deaa5d.strictEqual(actual, expected, message);
19
+ else __rspack_external_node_assert_a4deaa5d.strictEqual(actual, expected);
20
+ }
21
+ function assertEquals(actual, expected, message) {
22
+ if (!__rspack_external_effect_Equal_84d564fb.equals(actual, expected)) {
23
+ deepStrictEqual(actual, expected, message);
69
24
  fail(message ?? "Expected values to be Equal.equals");
70
25
  }
71
26
  }
72
- /**
73
- * Asserts that `thunk` does not throw an error.
74
- *
75
- * @category testing
76
- * @since 0.1.0
77
- */
78
- export function doesNotThrow(thunk, message, ..._) {
79
- assert.doesNotThrow(thunk, message);
27
+ function doesNotThrow(thunk, message) {
28
+ __rspack_external_node_assert_a4deaa5d.doesNotThrow(thunk, message);
80
29
  }
81
- /**
82
- * Asserts that `value` is an instance of `constructor`.
83
- *
84
- * @category testing
85
- * @since 0.1.0
86
- */
87
- export function assertInstanceOf(value, constructor, message, ..._) {
88
- rassert.instanceOf(value, constructor, message);
30
+ function assertInstanceOf(value, constructor, message) {
31
+ assert.instanceOf(value, constructor, message);
89
32
  }
90
- /**
91
- * Asserts that `self` is `true`.
92
- *
93
- * @category testing
94
- * @since 0.1.0
95
- */
96
- export function assertTrue(self, message, ..._) {
33
+ function assertTrue(self, message) {
97
34
  strictEqual(self, true, message);
98
35
  }
99
- /**
100
- * Asserts that `self` is `false`.
101
- *
102
- * @category testing
103
- * @since 0.1.0
104
- */
105
- export function assertFalse(self, message, ..._) {
36
+ function assertFalse(self, message) {
106
37
  strictEqual(self, false, message);
107
38
  }
108
- /**
109
- * Asserts that `actual` includes `expected`.
110
- *
111
- * @category testing
112
- * @since 0.1.0
113
- */
114
- export function assertInclude(actual, expected, ..._) {
115
- if (typeof expected === "string") {
116
- if (!actual?.includes(expected)) {
117
- fail(`Expected\n\n${actual}\n\nto include\n\n${expected}`);
118
- }
39
+ function assertInclude(actual, expected) {
40
+ if ("string" == typeof expected) {
41
+ if (!actual?.includes(expected)) fail(`Expected\n\n${actual}\n\nto include\n\n${expected}`);
119
42
  }
120
43
  }
121
- /**
122
- * Asserts that `actual` matches `regExp`.
123
- *
124
- * @category testing
125
- * @since 0.1.0
126
- */
127
- export function assertMatch(actual, regExp, ..._) {
128
- if (!regExp.test(actual)) {
129
- fail(`Expected\n\n${actual}\n\nto match\n\n${regExp}`);
130
- }
44
+ function assertMatch(actual, regExp) {
45
+ if (!regExp.test(actual)) fail(`Expected\n\n${actual}\n\nto match\n\n${regExp}`);
131
46
  }
132
- /**
133
- * Asserts that `thunk` throws, optionally checking the thrown value against an expected `Error` or validation function.
134
- *
135
- * @category testing
136
- * @since 0.1.0
137
- */
138
- export function throws(thunk, error, ..._) {
47
+ function utils_throws(thunk, error) {
139
48
  try {
140
49
  thunk();
141
- }
142
- catch (e) {
143
- if (error !== undefined) {
144
- if (Predicate.isFunction(error)) {
145
- error(e);
146
- }
147
- else if (error) {
148
- deepStrictEqual(e, error);
149
- }
150
- else {
151
- throw e;
152
- }
153
- }
50
+ } catch (e) {
51
+ if (void 0 !== error) if (__rspack_external_effect_Predicate_45f92690.isFunction(error)) error(e);
52
+ else if (error) deepStrictEqual(e, error);
53
+ else throw e;
154
54
  return;
155
55
  }
156
56
  fail("Expected to throw an error");
157
57
  }
158
- /**
159
- * Asserts that `thunk` throws or returns a rejected promise, optionally checking the failure value against an expected `Error` or validation function.
160
- *
161
- * @category testing
162
- * @since 0.1.0
163
- */
164
- export async function throwsAsync(thunk, error, ..._) {
58
+ async function throwsAsync(thunk, error) {
165
59
  try {
166
60
  await thunk();
167
- }
168
- catch (e) {
169
- if (error !== undefined) {
170
- if (Predicate.isFunction(error)) {
171
- error(e);
172
- }
173
- else {
174
- deepStrictEqual(e, error);
175
- }
176
- }
61
+ } catch (e) {
62
+ if (void 0 !== error) if (__rspack_external_effect_Predicate_45f92690.isFunction(error)) error(e);
63
+ else deepStrictEqual(e, error);
177
64
  return;
178
65
  }
179
66
  fail("Expected to throw an error");
180
67
  }
181
- /**
182
- * Asserts that `option` is `None`.
183
- *
184
- * @category testing
185
- * @since 0.1.0
186
- */
187
- export function assertNone(option, ..._) {
188
- deepStrictEqual(option, Option.none());
68
+ function assertNone(option) {
69
+ deepStrictEqual(option, __rspack_external_effect_Option_0498e63a.none());
189
70
  }
190
- /**
191
- * Asserts that `a` is not `undefined`.
192
- *
193
- * @category testing
194
- * @since 0.1.0
195
- */
196
- export function assertDefined(a, ..._) {
197
- if (a === undefined) {
198
- fail("Expected value to be defined");
199
- }
71
+ function assertDefined(a) {
72
+ if (void 0 === a) fail("Expected value to be defined");
200
73
  }
201
- /**
202
- * Asserts that `a` is `undefined`.
203
- *
204
- * @category testing
205
- * @since 0.1.0
206
- */
207
- export function assertUndefined(a, ..._) {
208
- if (a !== undefined) {
209
- fail("Expected value to be undefined");
210
- }
74
+ function assertUndefined(a) {
75
+ if (void 0 !== a) fail("Expected value to be undefined");
211
76
  }
212
- /**
213
- * Asserts that `option` is `Some` and contains a value equal to `expected`.
214
- *
215
- * @category testing
216
- * @since 0.1.0
217
- */
218
- export function assertSome(option, expected, ..._) {
219
- deepStrictEqual(option, Option.some(expected));
77
+ function assertSome(option, expected) {
78
+ deepStrictEqual(option, __rspack_external_effect_Option_0498e63a.some(expected));
220
79
  }
221
- /**
222
- * Asserts that `result` is `Success` and contains a value equal to `expected`.
223
- *
224
- * @category testing
225
- * @since 0.1.0
226
- */
227
- export function assertSuccess(result, expected, ..._) {
228
- deepStrictEqual(result, Result.succeed(expected));
80
+ function assertSuccess(result, expected) {
81
+ deepStrictEqual(result, __rspack_external_effect_Result_92419af5.succeed(expected));
229
82
  }
230
- /**
231
- * Asserts that `result` is `Failure` and contains an error equal to `expected`.
232
- *
233
- * @category testing
234
- * @since 0.1.0
235
- */
236
- export function assertFailure(result, expected, ..._) {
237
- deepStrictEqual(result, Result.fail(expected));
83
+ function assertFailure(result, expected) {
84
+ deepStrictEqual(result, __rspack_external_effect_Result_92419af5.fail(expected));
238
85
  }
239
- /**
240
- * Asserts that `exit` is a failure with a cause equal to `expected`.
241
- *
242
- * @category testing
243
- * @since 0.1.0
244
- */
245
- export function assertExitFailure(exit, expected, ..._) {
246
- deepStrictEqual(exit, Exit.failCause(expected));
86
+ function assertExitFailure(exit, expected) {
87
+ deepStrictEqual(exit, __rspack_external_effect_Exit_1ca64b33.failCause(expected));
247
88
  }
248
- /**
249
- * Asserts that `exit` is a success with a value equal to `expected`.
250
- *
251
- * @category testing
252
- * @since 0.1.0
253
- */
254
- export function assertExitSuccess(exit, expected, ..._) {
255
- deepStrictEqual(exit, Exit.succeed(expected));
89
+ function assertExitSuccess(exit, expected) {
90
+ deepStrictEqual(exit, __rspack_external_effect_Exit_1ca64b33.succeed(expected));
256
91
  }
92
+ export { assertDefined, assertEquals, assertExitFailure, assertExitSuccess, assertFailure, assertFalse, assertInclude, assertInstanceOf, assertMatch, assertNone, assertSome, assertSuccess, assertTrue, assertUndefined, deepStrictEqual, doesNotThrow, fail, notDeepStrictEqual, strictEqual, throwsAsync, utils_throws as throws };
93
+
257
94
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACtB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAI,MAAS,EAAE,QAAW,EAAE,OAAgB,EAAE,GAAG,CAAe;IAC7F,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,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CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA2B,EAC3B,QAAW,EACX,GAAG,CAAe;IAElB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA2B,EAC3B,QAAW,EACX,GAAG,CAAe;IAElB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAqB,EACrB,QAAwB,EACxB,GAAG,CAAe;IAElB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAqB,EACrB,QAAW,EACX,GAAG,CAAe;IAElB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;AAC/C,CAAC"}
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["/**\n * Provides assertion helpers used by `effect-rstest` tests.\n *\n * This module defines small assertion functions built on Node's `assert`,\n * Rstest's instance checks, and Effect's equality support. The helpers cover\n * basic equality, thrown errors, defined and undefined values, strings, regular\n * expressions, class instances, `Option`, `Result`, and `Exit`. Most helpers are\n * synchronous; `throwsAsync` handles rejected promises.\n *\n * @since 0.1.0\n */\nimport { assert as rassert } from \"@rstest/core\"\nimport type * as Cause from \"effect/Cause\"\nimport * as Equal from \"effect/Equal\"\nimport * as Exit from \"effect/Exit\"\nimport * as Option from \"effect/Option\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Result from \"effect/Result\"\nimport * as assert from \"node:assert\"\n\n/**\n * Fails the current test with the provided error message.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function fail(message: string) {\n assert.fail(message)\n}\n\n/**\n * Asserts that `actual` is deeply strictly equal to `expected` using Node's `assert.deepStrictEqual`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function deepStrictEqual<A>(actual: A, expected: A, message?: string, ..._: Array<never>) {\n assert.deepStrictEqual(actual, expected, message as string)\n}\n\n/**\n * Asserts that `actual` is not deeply strictly equal to `expected` using Node's `assert.notDeepStrictEqual`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function notDeepStrictEqual<A>(actual: A, expected: A, message?: string, ..._: Array<never>) {\n assert.notDeepStrictEqual(actual, expected, message as string)\n}\n\n/**\n * Asserts that `actual` is strictly equal to `expected` using Node's `assert.strictEqual`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function strictEqual<A>(actual: A, expected: A, message?: string, ..._: Array<never>) {\n if (message !== undefined) {\n assert.strictEqual(actual, expected, message)\n } else {\n assert.strictEqual(actual, expected)\n }\n}\n\n/**\n * Asserts that `actual` is equal to `expected` using the `Equal.equals` trait.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertEquals<A>(actual: A, expected: A, message?: string, ..._: Array<never>) {\n if (!Equal.equals(actual, expected)) {\n deepStrictEqual(actual, expected, message) // show diff\n fail(message ?? \"Expected values to be Equal.equals\")\n }\n}\n\n/**\n * Asserts that `thunk` does not throw an error.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function doesNotThrow(thunk: () => void, message?: string, ..._: Array<never>) {\n assert.doesNotThrow(thunk, message)\n}\n\n/**\n * Asserts that `value` is an instance of `constructor`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertInstanceOf<C extends abstract new(...args: any) => any>(\n value: unknown,\n constructor: C,\n message?: string,\n ..._: Array<never>\n): asserts value is InstanceType<C> {\n rassert.instanceOf(value, constructor as any, message)\n}\n\n/**\n * Asserts that `self` is `true`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertTrue(self: unknown, message?: string, ..._: Array<never>): asserts self {\n strictEqual(self, true, message)\n}\n\n/**\n * Asserts that `self` is `false`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertFalse(self: boolean, message?: string, ..._: Array<never>) {\n strictEqual(self, false, message)\n}\n\n/**\n * Asserts that `actual` includes `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertInclude(actual: string | undefined, expected: string, ..._: Array<never>) {\n if (typeof expected === \"string\") {\n if (!actual?.includes(expected)) {\n fail(`Expected\\n\\n${actual}\\n\\nto include\\n\\n${expected}`)\n }\n }\n}\n\n/**\n * Asserts that `actual` matches `regExp`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertMatch(actual: string, regExp: RegExp, ..._: Array<never>) {\n if (!regExp.test(actual)) {\n fail(`Expected\\n\\n${actual}\\n\\nto match\\n\\n${regExp}`)\n }\n}\n\n/**\n * Asserts that `thunk` throws, optionally checking the thrown value against an expected `Error` or validation function.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function throws(thunk: () => void, error?: Error | ((u: unknown) => undefined), ..._: Array<never>) {\n try {\n thunk()\n } catch (e) {\n if (error !== undefined) {\n if (Predicate.isFunction(error)) {\n error(e)\n } else if (error) {\n deepStrictEqual(e, error)\n } else {\n throw e\n }\n }\n return\n }\n fail(\"Expected to throw an error\")\n}\n\n/**\n * Asserts that `thunk` throws or returns a rejected promise, optionally checking the failure value against an expected `Error` or validation function.\n *\n * @category testing\n * @since 0.1.0\n */\nexport async function throwsAsync(\n thunk: () => Promise<void>,\n error?: Error | ((u: unknown) => undefined),\n ..._: Array<never>\n) {\n try {\n await thunk()\n } catch (e) {\n if (error !== undefined) {\n if (Predicate.isFunction(error)) {\n error(e)\n } else {\n deepStrictEqual(e, error)\n }\n }\n return\n }\n fail(\"Expected to throw an error\")\n}\n\n/**\n * Asserts that `option` is `None`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertNone<A>(option: Option.Option<A>, ..._: Array<never>): asserts option is Option.None<never> {\n deepStrictEqual(option, Option.none())\n}\n\n/**\n * Asserts that `a` is not `undefined`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertDefined<A>(\n a: A | undefined,\n ..._: Array<never>\n): asserts a is Exclude<A, undefined> {\n if (a === undefined) {\n fail(\"Expected value to be defined\")\n }\n}\n\n/**\n * Asserts that `a` is `undefined`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertUndefined<A>(\n a: A | undefined,\n ..._: Array<never>\n): asserts a is undefined {\n if (a !== undefined) {\n fail(\"Expected value to be undefined\")\n }\n}\n\n/**\n * Asserts that `option` is `Some` and contains a value equal to `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertSome<A>(\n option: Option.Option<A>,\n expected: A,\n ..._: Array<never>\n): asserts option is Option.Some<A> {\n deepStrictEqual(option, Option.some(expected))\n}\n\n/**\n * Asserts that `result` is `Success` and contains a value equal to `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertSuccess<A, E>(\n result: Result.Result<A, E>,\n expected: A,\n ..._: Array<never>\n): asserts result is Result.Success<A, never> {\n deepStrictEqual(result, Result.succeed(expected))\n}\n\n/**\n * Asserts that `result` is `Failure` and contains an error equal to `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertFailure<A, E>(\n result: Result.Result<A, E>,\n expected: E,\n ..._: Array<never>\n): asserts result is Result.Failure<never, E> {\n deepStrictEqual(result, Result.fail(expected))\n}\n\n/**\n * Asserts that `exit` is a failure with a cause equal to `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertExitFailure<A, E>(\n exit: Exit.Exit<A, E>,\n expected: Cause.Cause<E>,\n ..._: Array<never>\n): asserts exit is Exit.Failure<never, E> {\n deepStrictEqual(exit, Exit.failCause(expected))\n}\n\n/**\n * Asserts that `exit` is a success with a value equal to `expected`.\n *\n * @category testing\n * @since 0.1.0\n */\nexport function assertExitSuccess<A, E>(\n exit: Exit.Exit<A, E>,\n expected: A,\n ..._: Array<never>\n): asserts exit is Exit.Success<A, never> {\n deepStrictEqual(exit, Exit.succeed(expected))\n}\n"],"names":["fail","message","assert","deepStrictEqual","actual","expected","notDeepStrictEqual","strictEqual","undefined","assertEquals","Equal","doesNotThrow","thunk","assertInstanceOf","value","constructor","rassert","assertTrue","self","assertFalse","assertInclude","assertMatch","regExp","throws","error","e","Predicate","throwsAsync","assertNone","option","Option","assertDefined","a","assertUndefined","assertSome","assertSuccess","result","Result","assertFailure","assertExitFailure","exit","Exit","assertExitSuccess"],"mappings":";;;;;;;AA0BO,SAASA,KAAKC,OAAe;IAClCC,uCAAAA,IAAW,CAACD;AACd;AAQO,SAASE,gBAAmBC,MAAS,EAAEC,QAAW,EAAEJ,OAAgB;IACzEC,uCAAAA,eAAsB,CAACE,QAAQC,UAAUJ;AAC3C;AAQO,SAASK,mBAAsBF,MAAS,EAAEC,QAAW,EAAEJ,OAAgB;IAC5EC,uCAAAA,kBAAyB,CAACE,QAAQC,UAAUJ;AAC9C;AAQO,SAASM,YAAeH,MAAS,EAAEC,QAAW,EAAEJ,OAAgB;IACrE,IAAIA,AAAYO,WAAZP,SACFC,uCAAAA,WAAkB,CAACE,QAAQC,UAAUJ;SAErCC,uCAAAA,WAAkB,CAACE,QAAQC;AAE/B;AAQO,SAASI,aAAgBL,MAAS,EAAEC,QAAW,EAAEJ,OAAgB;IACtE,IAAI,CAACS,wCAAAA,MAAY,CAACN,QAAQC,WAAW;QACnCF,gBAAgBC,QAAQC,UAAUJ;QAClCD,KAAKC,WAAW;IAClB;AACF;AAQO,SAASU,aAAaC,KAAiB,EAAEX,OAAgB;IAC9DC,uCAAAA,YAAmB,CAACU,OAAOX;AAC7B;AAQO,SAASY,iBACdC,KAAc,EACdC,WAAc,EACdd,OAAgB;IAGhBe,OAAAA,UAAkB,CAACF,OAAOC,aAAoBd;AAChD;AAQO,SAASgB,WAAWC,IAAa,EAAEjB,OAAgB;IACxDM,YAAYW,MAAM,MAAMjB;AAC1B;AA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QAAW;IAGXF,gBAAgBiC,QAAQC,yCAAAA,OAAc,CAAChC;AACzC;AAQO,SAASiC,cACdF,MAA2B,EAC3B/B,QAAW;IAGXF,gBAAgBiC,QAAQC,yCAAAA,IAAW,CAAChC;AACtC;AAQO,SAASkC,kBACdC,IAAqB,EACrBnC,QAAwB;IAGxBF,gBAAgBqC,MAAMC,uCAAAA,SAAc,CAACpC;AACvC;AAQO,SAASqC,kBACdF,IAAqB,EACrBnC,QAAW;IAGXF,gBAAgBqC,MAAMC,uCAAAA,OAAY,CAACpC;AACrC"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "effect-rstest",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "Effect test helpers for Rstest",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Néstor López",
8
- "homepage": "https://github.com/nsttt/effect-rstest#readme",
8
+ "homepage": "https://github.com/Nsttt/effect-rstest#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/nsttt/effect-rstest.git"
11
+ "url": "https://github.com/Nsttt/effect-rstest"
12
12
  },
13
13
  "bugs": {
14
- "url": "https://github.com/nsttt/effect-rstest/issues"
14
+ "url": "https://github.com/Nsttt/effect-rstest/issues"
15
15
  },
16
16
  "keywords": [
17
17
  "effect",
@@ -42,7 +42,7 @@
42
42
  "access": "public"
43
43
  },
44
44
  "scripts": {
45
- "build": "tsc -p tsconfig.json",
45
+ "build": "rslib",
46
46
  "check": "tsc -p tsconfig.test.json",
47
47
  "test": "rstest run",
48
48
  "test:types": "tstyche --target '>=5.9'",
@@ -53,6 +53,7 @@
53
53
  "effect": ">=4.0.0-rc.112 <5.0.0"
54
54
  },
55
55
  "devDependencies": {
56
+ "@rslib/core": "1.0.0",
56
57
  "@rstest/core": "0.11.12",
57
58
  "@types/node": "^26.4.1",
58
59
  "effect": "4.0.0-rc.112",
@@ -1,177 +0,0 @@
1
- /**
2
- * @since 0.1.0
3
- */
4
- import * as R from "@rstest/core";
5
- import * as Cause from "effect/Cause";
6
- import * as Duration from "effect/Duration";
7
- import * as Effect from "effect/Effect";
8
- import * as Equal from "effect/Equal";
9
- import * as Exit from "effect/Exit";
10
- import { flow, pipe } from "effect/Function";
11
- import * as Layer from "effect/Layer";
12
- import * as Predicate from "effect/Predicate";
13
- import * as Schedule from "effect/Schedule";
14
- import * as Schema from "effect/Schema";
15
- import * as Scope from "effect/Scope";
16
- import { FastCheck as FC, TestClock, TestConsole } from "effect/testing";
17
- const runPromise = Effect.fnUntraced(function* (effect, _ctx) {
18
- const exit = yield* Effect.exit(effect);
19
- if (Exit.isFailure(exit)) {
20
- const errors = Cause.prettyErrors(exit.cause);
21
- for (let i = 0; i < errors.length; i++) {
22
- yield* Effect.logError(errors[i]);
23
- }
24
- }
25
- return yield* exit;
26
- }, (effect, _, ctx) => Effect.runPromise(effect, { signal: ctx?.signal }));
27
- /** @internal */
28
- const runTest = (ctx) => (effect) => runPromise(effect, ctx);
29
- const TestEnv = Layer.mergeAll(TestConsole.layer, TestClock.layer());
30
- /** @internal */
31
- export const addEqualityTesters = () => {
32
- R.expect.addEqualityTesters([
33
- (a, b) => Equal.isEqual(a) || Equal.isEqual(b) ? Equal.equals(a, b) : undefined
34
- ]);
35
- };
36
- const hookTimeout = (timeout) => timeout === undefined ? undefined : Duration.toMillis(Duration.fromInputUnsafe(timeout));
37
- /** @internal */
38
- const testOptions = (timeout) => {
39
- if (typeof timeout === "number") {
40
- return { timeout };
41
- }
42
- if (timeout === undefined) {
43
- return {};
44
- }
45
- const { fails: _, fastCheck: __, ...options } = timeout;
46
- return options;
47
- };
48
- const propertyTestOptions = (timeout) => typeof timeout === "number" ? undefined : timeout;
49
- const checkOptions = (timeout) => propertyTestOptions(timeout)?.fastCheck;
50
- const compileArbitraryInput = (input) => Schema.isSchema(input) ? Schema.toArbitrary(input)(FC) : input;
51
- const makeArbitrary = (arbitraries) => Array.isArray(arbitraries)
52
- ? FC.tuple(...arbitraries.map(compileArbitraryInput))
53
- : FC.record(Object.fromEntries(Object.entries(arbitraries).map(([key, input]) => [key, compileArbitraryInput(input)])));
54
- const normalizeProperty = (property, value) => Effect.catchCause(Effect.suspend(() => {
55
- const output = property(value);
56
- if (Predicate.isPromiseLike(output)) {
57
- throw new TypeError("Effect property tests must return an Effect or boolean");
58
- }
59
- return Effect.isEffect(output) ? output : Effect.succeed(output);
60
- }), (cause) => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.fail(cause));
61
- const normalizeSyncProperty = (property, value, ctx) => {
62
- const output = property(value, ctx);
63
- if (Predicate.isPromiseLike(output)) {
64
- throw new TypeError("Synchronous property tests must not return a Promise");
65
- }
66
- return output !== false;
67
- };
68
- const runCheck = (ctx, arbitrary, property, options) => FC.assert(FC.asyncProperty(arbitrary, (value) => runTest(ctx)(normalizeProperty(property, value))), options);
69
- const makeItProxy = (it, overrides) => new Proxy(it, {
70
- apply(target, thisArg, argArray) {
71
- return Reflect.apply(target, thisArg, argArray);
72
- },
73
- get(target, property, receiver) {
74
- if (Object.hasOwn(overrides, property)) {
75
- return Reflect.get(overrides, property);
76
- }
77
- // do not bind: binding would strip Rstest's static helpers
78
- return Reflect.get(target, property, receiver);
79
- }
80
- });
81
- /** @internal */
82
- const makeTester = (mapEffect, it = R.it) => {
83
- const run = (ctx, args, self) => pipe(Effect.suspend(() => self(...args)), mapEffect, Effect.asVoid, runTest(ctx));
84
- const f = (name, self, timeout) => it(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
85
- const skip = (name, self, timeout) => it.skip(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
86
- const skipIf = (condition) => (name, self, timeout) => it.skipIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
87
- const runIf = (condition) => (name, self, timeout) => it.runIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
88
- const only = (name, self, timeout) => it.only(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
89
- const concurrent = (name, self, timeout) => it.concurrent(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
90
- const sequential = (name, self, timeout) => it.sequential(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
91
- const each = (cases) => (name, self, timeout) => {
92
- it.for(cases)(name, testOptions(timeout), (args, ctx) => run(ctx, [args], self));
93
- };
94
- const fails = (name, self, timeout) => it.fails(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self));
95
- const prop = (name, arbitraries, self, timeout) => {
96
- const arbitrary = makeArbitrary(arbitraries);
97
- const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it;
98
- return testApi(name, testOptions(timeout), (ctx) => runCheck(ctx, arbitrary, (values) => Effect.mapEager(mapEffect(Effect.suspend(() => self(values, ctx))), (value) => value !== false), checkOptions(timeout)));
99
- };
100
- return Object.assign(f, { skip, skipIf, runIf, only, concurrent, sequential, each, fails, prop });
101
- };
102
- /** @internal */
103
- const makeProp = (it) => (name, arbitraries, self, timeout) => {
104
- const arbitrary = makeArbitrary(arbitraries);
105
- const testApi = propertyTestOptions(timeout)?.fails ? it.fails : it;
106
- return testApi(name, testOptions(timeout), (ctx) => runCheck(ctx, arbitrary, (values) => normalizeSyncProperty(self, values, ctx), checkOptions(timeout)));
107
- };
108
- /** @internal */
109
- export const prop = makeProp(R.it);
110
- /** @internal */
111
- export const layer = (layer_, options, testApi = R.it) => (...args) => {
112
- const excludeTestServices = options?.excludeTestServices ?? false;
113
- const withTestEnv = excludeTestServices
114
- ? layer_
115
- : Layer.provideMerge(layer_, TestEnv);
116
- const memoMap = options?.memoMap ?? Effect.runSync(Layer.makeMemoMap);
117
- const scope = Effect.runSync(Scope.make());
118
- const contextEffect = Layer.buildWithMemoMap(withTestEnv, memoMap, scope).pipe(Effect.orDie, Effect.cached, Effect.runSync);
119
- let closePromise;
120
- const closeScope = () => {
121
- if (closePromise !== undefined) {
122
- return closePromise;
123
- }
124
- closePromise = runPromise(Scope.close(scope, Exit.void)).then(() => { });
125
- return closePromise;
126
- };
127
- const makeIt = (it) => makeItProxy(it, {
128
- effect: makeTester((effect) => Effect.flatMap(contextEffect, (context) => effect.pipe(Effect.scoped, Effect.provide(context))), it),
129
- prop: makeProp(it),
130
- flakyTest,
131
- layer(nestedLayer, options) {
132
- return layer(Layer.provideMerge(nestedLayer, withTestEnv), {
133
- ...options,
134
- memoMap: Layer.forkMemoMapUnsafe(memoMap),
135
- excludeTestServices
136
- }, it);
137
- }
138
- });
139
- if (args.length === 1) {
140
- const timeout = hookTimeout(options?.timeout);
141
- return R.describe("", () => {
142
- R.beforeAll(() => runPromise(Effect.asVoid(contextEffect)), timeout);
143
- R.afterAll(() => closeScope(), timeout);
144
- return args[0](makeIt(testApi));
145
- });
146
- }
147
- const describe = options?.concurrent === true
148
- ? R.describe.concurrent
149
- : options?.concurrent === false
150
- ? R.describe.sequential
151
- : R.describe;
152
- return describe(args[0], () => {
153
- R.beforeAll(() => runPromise(Effect.asVoid(contextEffect)), hookTimeout(options?.timeout));
154
- R.afterAll(() => closeScope(), hookTimeout(options?.timeout));
155
- return args[1](makeIt(testApi));
156
- });
157
- };
158
- const makeLayer = (it) => (layer_, options) => layer(layer_, options, it);
159
- /** @internal */
160
- export const flakyTest = (self, timeout = Duration.seconds(30)) => pipe(self, Effect.scoped, Effect.sandbox, Effect.retry(pipe(Schedule.recurs(10), Schedule.while((_) => Effect.succeed(Duration.isLessThanOrEqualTo(Duration.fromInputUnsafe(_.elapsed), Duration.fromInputUnsafe(timeout)))))), Effect.orDie);
161
- /** @internal */
162
- export const makeMethods = (it) => makeItProxy(it, {
163
- effect: makeTester(flow(Effect.scoped, Effect.provide(TestEnv)), it),
164
- live: makeTester(Effect.scoped, it),
165
- flakyTest,
166
- layer: makeLayer(it),
167
- prop: makeProp(it)
168
- });
169
- /** @internal */
170
- export const {
171
- /** @internal */
172
- effect,
173
- /** @internal */
174
- live } = makeMethods(R.it);
175
- /** @internal */
176
- export const describeWrapped = (name, f) => R.describe(name, () => f(makeMethods(R.it)));
177
- //# sourceMappingURL=internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAGxE,MAAM,UAAU,GAGE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAO,MAA2B,EAAE,IAAyB;IACxG,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,C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