`@effect/vitest`: `it.prop` passes a property that returns an Effect, without running it
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)Posiblemente ocupada @santiago-ramos-02 la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Effect-TS/effect#8635 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Support {self: this} for fnUntracedQuizá libre de nuevo @ArjunCodess la tomó hace 28 días y no hay ningún pull request abierto. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Effect-TS/effect#8101 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
RcMap, RcRef and ScopedCache: a dying release is lost on idle expiry, an interrupted lookup, or expiry during `keys`/`values`/`entries`Posiblemente ocupada @effect-bot la tomó hace 1 día. Abierto
Effect-TS/effect#9372 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Chocobozzz/PeerTube#7832 ·
Los mantenedores suelen responder en 3 días
-
Pay to use?Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 66/100
darkreader/darkreader#16108 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Add: Dak Nong TV SDAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug engine
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
frostney/GocciaScript#1746 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
agilepathway/label-checker#739 · 4 comentarios ·
Los mantenedores suelen responder en 1 día