Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`@effect/vitest`: `it.prop` passes a property that returns an Effect, without running it

Abierto
#9,373 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
testing

Línea de trabajo

Start in packages/vitest/src/internal/internal.ts: makeProp compares the callback result with !== false around lines 234-236, and normalizeProperty around lines 99-110 already runs Effects. The callback type in packages/vitest/src/index.ts (lines 172-186) is => void. Reproduce with the snippet in the issue, where it.prop passes but it.effect.prop fails. Done means an Effect- or Promise-returning it.prop property fails the test (or is a type error), while boolean, void and assertion-only callbacks still pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

What version of Effect is running?

[email protected], @effect/[email protected], Vitest 5.0.3, Node 26.11.1. packages/vitest is unchanged on main.

What steps can reproduce the bug?

When an it.prop property returns an Effect, for instance where it.effect.prop was meant, the test passes and the Effect never runs. It type-checks, because the callback is typed => void.

import { assert, it } from "@effect/vitest"
import { Effect, Schema } from "effect"

// passes
it.prop("prop", [Schema.Int], () => Effect.fail("boom"))

// passes; the assertion never runs
it.prop("prop with assertion", [Schema.Int], ([n]) =>
  Effect.sync(() => assert.strictEqual(n, -1)))

// fails: Property falsified ... Failure: Error: boom
it.effect.prop("effect.prop", [Schema.Int], () => Effect.fail("boom"))
 ✓ issue-repro.test.ts > prop
 ✓ issue-repro.test.ts > prop with assertion
 × issue-repro.test.ts > effect.prop
What is the expected behavior?

A property that returns an Effect (or a Promise) is rejected, either by the type or by failing the test. In Effect 3 (@effect/[email protected]), both it.prop tests above fail with Property failed by returning false, as it.prop did in the 4.0 prereleases up to 4.0.0-rc.112.

What do you see instead?

Both it.prop tests pass, and the returned Effect never runs. An async property also passes. Its rejection shows up only as a run-level "Unhandled Rejection", which is not attributed to the test and is not shrunk.

Additional information

makeProp compares the callback's result with !== false (internal.ts#L234-L236). A returned Effect or Promise therefore counts as a pass before the runner sees it, although normalizeProperty would run an Effect (#L99-L110). The callback type => void (index.ts#L172-L186) accepts any return.

The README documents that any return other than false passes (README.md#L77-L79). That rule and the !== false check came with #7254. Before it, it.prop ran through fast-check's fc.property, which fails any return other than undefined or true.

Typing the callback's return as boolean | void makes both an Effect-returning and an async callback a type error, and still accepts boolean, assertion-only and throwing callbacks.

Lenguaje dominante
TypeScript
Estrellas
16.7k
Forks
808
Merge medio
9 h 39 min
PR fusionados (30 d)
703

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Effect-TS/effect

Todos los issues de Effect-TS/effect

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.