Tests Fail After Updating Application to Latest Effect and Schema Versions

Hi! I'm updating an application from effect 2.0.1 and schema 0.57.1 to the latest versions, and some of my tests are failing.

I extracted a minimal reproducible example where all these tests passes with schema 0.57.1:

import * as S from "@effect/schema/Schema"
import { formatErrors } from "@effect/schema/TreeFormatter"
import { expect, test } from "vitest"
import * as E from "effect/Either"

const LongString = S.string.pipe(
    S.filter((s) => s.length >= 10, {
        message: () => "a string at least 10 characters long",
    }),
)

const decode = S.parseEither(LongString)

test("short string", () => {
    const result = decode("1234")

    const error = expectLeft(result)
    expect(formatErrors(error.errors)).toMatch("a string at least 10 characters long")
})

test.each([null, undefined])("invalid strings %s", (input) => {
    const result = decode(input)

    const error = expectLeft(result)
    expect(formatErrors(error.errors)).toMatch(`Expected string, actual ${input}`)
})

const expectLeft = <E, A>(e: E.Either<E, A>) => {
    if (E.isRight(e)) throw new Error(`Either is right: ${e.right}`)
    return e.left
}


Continued on thread -->
Was this page helpful?