( mapEffect: <A, E>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, never>, it: Vitest.API = defaultApi )
| 84 | |
| 85 | /** @internal */ |
| 86 | const makeTester = <R>( |
| 87 | mapEffect: <A, E>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, never>, |
| 88 | it: Vitest.API = defaultApi |
| 89 | ): Vitest.Vitest.Tester<R> => { |
| 90 | const run = <A, E, TestArgs extends Array<unknown>>( |
| 91 | ctx: V.TestContext & object, |
| 92 | args: TestArgs, |
| 93 | self: Vitest.Vitest.TestFunction<A, E, R, TestArgs> |
| 94 | ) => pipe(Effect.suspend(() => self(...args)), mapEffect, runTest(ctx)) |
| 95 | |
| 96 | const f: Vitest.Vitest.Test<R> = (name, self, timeout) => |
| 97 | it(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 98 | |
| 99 | const skip: Vitest.Vitest.Tester<R>["only"] = (name, self, timeout) => |
| 100 | it.skip(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 101 | |
| 102 | const skipIf: Vitest.Vitest.Tester<R>["skipIf"] = (condition) => (name, self, timeout) => |
| 103 | it.skipIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 104 | |
| 105 | const runIf: Vitest.Vitest.Tester<R>["runIf"] = (condition) => (name, self, timeout) => |
| 106 | it.runIf(condition)(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 107 | |
| 108 | const only: Vitest.Vitest.Tester<R>["only"] = (name, self, timeout) => |
| 109 | it.only(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 110 | |
| 111 | const each: Vitest.Vitest.Tester<R>["each"] = (cases) => (name, self, timeout) => |
| 112 | it.for(cases)( |
| 113 | name, |
| 114 | testOptions(timeout), |
| 115 | (args, ctx) => run(ctx, [args], self) as any |
| 116 | ) |
| 117 | |
| 118 | const fails: Vitest.Vitest.Tester<R>["fails"] = (name, self, timeout) => |
| 119 | V.it.fails(name, testOptions(timeout), (ctx) => run(ctx, [ctx], self)) |
| 120 | |
| 121 | const prop: Vitest.Vitest.Tester<R>["prop"] = (name, arbitraries, self, timeout) => { |
| 122 | if (Array.isArray(arbitraries)) { |
| 123 | const arbs = arbitraries.map((arbitrary) => Schema.isSchema(arbitrary) ? Arbitrary.make(arbitrary) : arbitrary) |
| 124 | return it( |
| 125 | name, |
| 126 | testOptions(timeout), |
| 127 | (ctx) => |
| 128 | // @ts-ignore |
| 129 | fc.assert( |
| 130 | // @ts-ignore |
| 131 | fc.asyncProperty(...arbs, (...as) => run(ctx, [as as any, ctx], self)), |
| 132 | isObject(timeout) ? timeout?.fastCheck : {} |
| 133 | ) |
| 134 | ) |
| 135 | } |
| 136 | |
| 137 | const arbs = fc.record( |
| 138 | Object.keys(arbitraries).reduce(function(result, key) { |
| 139 | result[key] = Schema.isSchema(arbitraries[key]) ? Arbitrary.make(arbitraries[key]) : arbitraries[key] |
| 140 | return result |
| 141 | }, {} as Record<string, fc.Arbitrary<any>>) |
| 142 | ) |
| 143 |
no outgoing calls
no test coverage detected
searching dependent graphs…