-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Labels
Description
Describe the bug
Effect's Schema implements Standard Schema interop as a class atop its own constructs, causing Vitest's internal isStandardSchema type guard to fail.
- https://effect.website/docs/schema/standard-schema/
- https://standardschema.dev/ (listed here as implementing the spec)
- https://github.com/vitest-dev/vitest/blob/main/packages/expect/src/jest-utils.ts#L810
I'm assuming it's the typeof obj === 'object' given both the fact that Schema uses a class under the hood and the fact that interop can be achieved by spreading Effect's output, as per the repro.
Reproduction
import { Schema } from 'effect';
import { describe, expect, it } from 'vitest';
describe('repro', () => {
it('fails', () => {
expect('foo').toEqual(
expect.schemaMatching(Schema.standardSchemaV1(Schema.String)),
);
});
it('succeeds', () => {
expect('foo').toEqual(
expect.schemaMatching({ ...Schema.standardSchemaV1(Schema.String) }),
);
});
});System Info
System:
OS: macOS 26.1
CPU: (12) arm64 Apple M2 Pro
Memory: 842.14 MB / 32.00 GB
Shell: 4.1.2 - /Users/sam/.nix-profile/bin/fish
Binaries:
Node: 22.21.1 - /nix/store/icgwxxfs13q1y864dd9ln86scp5659mw-nodejs-22.21.1/bin/node
npm: 10.9.4 - /nix/store/icgwxxfs13q1y864dd9ln86scp5659mw-nodejs-22.21.1/bin/npm
pnpm: 10.15.0 - /nix/store/zxr2z04s11vsmdx5ybdnyld2kllvlq61-pnpm-10.20.0/bin/pnpm
Browsers:
Firefox Developer Edition: 144.0
Safari: 26.1Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.