MCPcopy Index your code
hub / github.com/Effect-TS/effect / prop

Function prop

packages/vitest/src/internal/internal.ts:121–156  ·  view source on GitHub ↗
(name, arbitraries, self, timeout)

Source from the content-addressed store, hash-verified

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
144 return it(
145 name,
146 testOptions(timeout),
147 (ctx) =>
148 // @ts-ignore
149 fc.assert(
150 fc.asyncProperty(arbs, (...as) =>
151 // @ts-ignore
152 run(ctx, [as[0] as any, ctx], self)),
153 isObject(timeout) ? timeout?.fastCheck : {}
154 )
155 )
156 }
157
158 return Object.assign(f, { skip, skipIf, runIf, only, each, fails, prop })
159}

Callers

nothing calls this directly

Calls 8

isObjectFunction · 0.90
itFunction · 0.85
testOptionsFunction · 0.85
keysMethod · 0.80
runFunction · 0.70
mapMethod · 0.65
makeMethod · 0.65
assertMethod · 0.65

Tested by

no test coverage detected