Skip to content

bun:test expect is sync and doesn't work with .rejects #4909

@moderj

Description

@moderj

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

create an async function that should throw an error.
using expect with .rejects should start with await before the expect as said in the jest api
jest-api

image

What is the expected behavior?

the test should run successfully with this syntax as bun should be compatible with jest api and .rejects also appear to be implemented in bun docs.

What do you see instead?

image

await has no effect because the bun's type of expect is:

image

The error I get:

image

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions