Skip to content

Instantly share code, notes, and snippets.

@addisonElliott
Created February 22, 2022 13:25
Show Gist options
  • Save addisonElliott/b16053072327587ad3562e35b61026a6 to your computer and use it in GitHub Desktop.
Save addisonElliott/b16053072327587ad3562e35b61026a6 to your computer and use it in GitHub Desktop.
bull-jest-promise-timeout-issue
{
"name": "bull-jest-issue",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest"
},
"author": "",
"license": "ISC",
"dependencies": {
"bull": "^4.6.1",
"jest": "^27.5.1"
}
}
const Bull = require('bull');
describe('testing Bull bug', () => {
let queue;
async function processValidateSites(job) {
console.log('1.1');
}
function onFailedJob(job, err) {
console.log('1.2');
}
function initProcesses() {
queue.process('validateSites', 2, processValidateSites);
queue.on('failed', onFailedJob);
}
beforeAll(async () => {
queue = new Bull('test-bull-queue', 'redis://127.0.0.1:6379', {
defaultJobOptions: {
removeOnComplete: true,
removeOnFail: true,
},
});
await Promise.all([queue.clean(0, 'active'), queue.clean(0, 'failed')]);
initProcesses();
});
afterAll(async () => {
await queue.obliterate({ force: true });
await queue.close(true);
});
beforeEach(async () => {
// Wipe queue data
await queue.obliterate({ force: true });
});
it('random test', () => {
expect(1).toBe(1);
});
it('random test 2', () => {
expect(1).toBe(1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment