adding jest.useRealTimers();
to my test fixed this for me. Didn't need the setImmediate patch.
My minimal example reproducing this was
import ExcelJS from 'exceljs';
...
it('test excel write to buffer', async () => {
const workbook = new ExcelJS.Workbook();
workbook.addWorksheet('Sheet1');
await workbook.xlsx.writeBuffer(); // uses jszip internally and times out
});
Fixed:
...
it('test excel write to buffer', async () => {
jest.useRealTimers();
const workbook = new ExcelJS.Workbook();
...