Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing with bull in Jest #2791

Open
OliverVerdesseldonck opened this issue Mar 19, 2025 · 3 comments
Open

Testing with bull in Jest #2791

OliverVerdesseldonck opened this issue Mar 19, 2025 · 3 comments

Comments

@OliverVerdesseldonck
Copy link

Hello, I am using Bull in some of my API calls in express.js.

I am writing now tests in jest, using supertest to make calls to my API. But the bull Job has not finished in the Queue when my test checks on the result and gives failed test.

Currently, I am using a sleep function with a setTimeout, is not very accurate. Is there a way with Bull and jest to check the result after the Queue job has finished?

@manast
Copy link
Member

manast commented Mar 19, 2025

If you are starting with Bull, it would be much much better that you jump directly to BullMQ: https://github.com/taskforcesh/bullmq

@manast
Copy link
Member

manast commented Mar 19, 2025

For tests you could then use: https://api.docs.bullmq.io/classes/v5.Job.html#waitUntilFinished

@OliverVerdesseldonck
Copy link
Author

OliverVerdesseldonck commented Mar 26, 2025

If you are starting with Bull, it would be much much better that you jump directly to BullMQ: https://github.com/taskforcesh/bullmq

@manast Jumping to BullMQ is directly possible. I mainly use Bull.js in a work application and upgrading is they realy want the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants