You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{describe,expect,it}from'bun:test';describe('expect-any',()=>{it('should accept any string',()=>{expect({name: 'alice'}).toEqual({name: expect.any(String)});expect({name: 'bob'}).toEqual({name: expect.any(String)});expect({name: 'charlie'}).toEqual({name: expect.any(String)});});it('should accept any number',()=>{expect({age: 42}).toEqual({age: expect.any(Number)});expect({age: 69}).toEqual({age: expect.any(Number)});expect({age: 73}).toEqual({age: expect.any(Number)});});it('should accept any boolean',()=>{expect({active: false}).toEqual({active: expect.any(Boolean)});expect({active: true}).toEqual({active: expect.any(Boolean)});});});
What is the expected behavior?
The tests should pass
bun test v0.6.9 (bdb1b712)
expect-any.spec.ts:
✓ expect-any > should accept any string
✓ expect-any > should accept any number
✓ expect-any > should accept any boolean
3 pass
0 fail
9 expect() calls
Ran 3 tests across 1 files [12.00ms]
I noticed that according to the docs this feature is not implemented yet. However, it seems to exist on the runtime right now even though there are no typings for it. I considered making this a feature request but the bug report template seemed to match better.
The text was updated successfully, but these errors were encountered:
According to https://bun.sh/docs/test/writing#matchersexpect.any() is now implemented. I saw a change in test output from {} to Any<Boolean> as example but the tests still fail.
What version of Bun is running?
0.6.9
What platform is your computer?
Darwin 22.5.0 arm64 arm
What steps can reproduce the bug?
please run the following code using
bun test
:What is the expected behavior?
The tests should pass
What do you see instead?
The tests fail
Additional information
I noticed that according to the docs this feature is not implemented yet. However, it seems to exist on the runtime right now even though there are no typings for it. I considered making this a feature request but the bug report template seemed to match better.
The text was updated successfully, but these errors were encountered: