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

Using queue.process during test prevent jest from exiting #2244

Closed
palumbamboo opened this issue Dec 30, 2021 · 7 comments
Closed

Using queue.process during test prevent jest from exiting #2244

palumbamboo opened this issue Dec 30, 2021 · 7 comments
Labels

Comments

@palumbamboo
Copy link

palumbamboo commented Dec 30, 2021

Description

If queue.process appears at least once in the code executed during the tests, then jest does not exit one second after the test run has completed.

If i put await in front of queue.process(...), nothing happens. The code blocks on this instruction until Jest raises error for time expire.

I've tried several solutions, but none seems to work:

  • queue.close()
  • queue.process with/without async, promises or done callback
  • queue.clean()
  • queue.obliterate()
  • increase jest waiting time
  • decrease bull lock duration
  • use --detectOpenHandles -> with this option jest never exits at all

Every queue event callback (like closed, cleaned, drained, ...) is correctly fired. Jobs are correctly executed. Everything with Bull seems to work fine. The only problem is with queue.process(...) method.

Minimal, Working Test code to reproduce the issue.

(An easy to reproduce test case will dramatically decrease the resolution time.)

import Queue from 'bull'

describe('simple-test', () => {
  it('breaking-process-test', async () => {
    const queue = new Queue('test-queue')

    queue.process((job, done) => done())
    await queue.add({data: 'hello world'})

    expect(1).toBeTruthy()

    await queue.close()
  })
})

image

Bull version

^4.2.0

Additional information

NodeJs Version: 14.18.1
Jest Version: ^27.4.5

@stale
Copy link

stale bot commented Feb 28, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 28, 2022
@stale stale bot closed this as completed Mar 7, 2022
@longhoangwkm
Copy link

I got it too

@oyatek
Copy link

oyatek commented Aug 17, 2022

me too :(

@yongkangc
Copy link

same here

@manast
Copy link
Member

manast commented Nov 7, 2022

I think BullMQ supports Jest now, but unless somebody provides a PR with a fix for Bull this issue will most likely remain unresolved.

@melalj
Copy link

melalj commented Oct 12, 2023

Any update on this?

@rohit-uf
Copy link

Also got this error.
running with the --detectOpenHandles pinpoints to the following location in code

node_modules/ioredis/built/connectors/StandaloneConnector.js:44:21

image

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

No branches or pull requests

7 participants