I am trying out some pipelines in my Vitest environment and I have noticed, that I am not getting any errors logged there by default. When the following code snippet fails, I get no output in the console log. Just that the test silently failed:
import { Effect, Option } from "effect"const anonymousToken = () => { return Option.some(JSON.stringify({ name: "My Name" }))}const decodeToken = (shouldFail: boolean) => { return (token: string) => { return Effect.promise((): Promise<{ name: string }> => { if (shouldFail) { return Promise.reject(new Error('Failed to decode token')); } return Promise.resolve(JSON.parse(token)); }) }}// Code is executed within Vitest. ex: it('...', () => { ... })(async () => { var result = await Effect.runPromise( anonymousToken().pipe( Effect.flatMap(decodeToken(true)), Effect.optionFromOptional ) ) console.log(result);})();
import { Effect, Option } from "effect"const anonymousToken = () => { return Option.some(JSON.stringify({ name: "My Name" }))}const decodeToken = (shouldFail: boolean) => { return (token: string) => { return Effect.promise((): Promise<{ name: string }> => { if (shouldFail) { return Promise.reject(new Error('Failed to decode token')); } return Promise.resolve(JSON.parse(token)); }) }}// Code is executed within Vitest. ex: it('...', () => { ... })(async () => { var result = await Effect.runPromise( anonymousToken().pipe( Effect.flatMap(decodeToken(true)), Effect.optionFromOptional ) ) console.log(result);})();
The odd thing that I noticed is that the playground is not silently failing. This leads me to thinking there is probably some environment variable that I need to set, or there might be a bug in the latest version of effect.ts? I'm using the latest 3.19.8 version.