Effect-TS / effect

An ecosystem of tools for building production-grade applications in TypeScript.
https://effect.website
MIT License
7.2k stars 229 forks source link

Vitest: Add support for property testing #3698

Open jessekelly881 opened 1 week ago

jessekelly881 commented 1 week ago

What is the problem this feature would solve?

Adding property testing with schema and effect would be a nice addition. Similar to: https://www.npmjs.com/package/@fast-check/vitest

What is the feature you are proposing to solve the problem?

import { Schema } from "@effect/schema";
import { it } from "@effect/vitest";
import { Effect } from "effect";

it.prop(Schema.Number, Schema.Number).sync("", (a: number, b: number) => {
    return a + b === b + a
})

it.prop(Schema.Number, Schema.Number).effect("", (a: number, b: number) => Effect.gen(function* () {
    return a + b === b + a; 
}))

What alternatives have you considered?

No response

jessekelly881 commented 6 days ago

I'll create a PR.