-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
3.2.0 - Typechecking rejecting toEqual on Map with values mixing expect.any and real values #8082
Copy link
Copy link
Labels
Description
Describe the bug
While this code used to be legit in 3.1.x, it started not to be in 3.2.0 (possibly due to #7016).
// Does not compile
expect(new Map<string, number>()).toEqual(
new Map([
['a', 1],
['b', expect.any(Number)],
])
);
// Compiles
expect(new Map<string, number>()).toEqual(new Map([['a', 1]]));
// Compiles
expect(new Map<string, number>()).toEqual(new Map([['b', expect.any(Number)]]));As it does not seem to be related to #8081 or #8079 I opened this dedicated issue.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-q2nrapfj?file=test%2Fbasic.test.ts
System Info
System:
OS: Windows 11 10.0.26100
CPU: (12) arm64 Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) CPU
Memory: 37.08 GB / 63.49 GB
Binaries:
Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.6.5 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Chromium (133.0.3065.69)
npmPackages:
@vitest/coverage-v8: ^3.1.4 => 3.1.4
vitest: ^3.2.0 => 3.2.0Used Package Manager
npm
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Approved