Jest async test using `done` callback syntax doesn't work with autoPreview: true
Describe the bug
When jest-preview's autoPreview: true:
Using Jest's done callback syntax to write an asynchronous test (Jest documentation), the test fails because done is undefined.
With autoPreview: false, there is no issue.
Screenshots
Reproduce
Forked the official jest-preview stackblitz demo, then used the done async syntax in App.test.tsx, and the bug appears.
Repro: https://stackblitz.com/edit/jest-preview-zfv89j?file=src%2FApp.test.tsx
Expected behavior
With autoPreview: true, done callback should be defined, and will end the test when called.
Environment (please complete the following information)
- OS: macOS 14.4.1
- Browser: Chrome
- Jest version: 27.5.1 (can also repro the bug in a private project on jest 29.7.0)
Additional context
The issue feels like it's around where the Jest it function is patched for autoPreview, here:
https://github.com/nvh95/jest-preview/blob/880630f4165a55a7e2cced981b1275e32416e5ee/src/configure.ts#L80-L102
similarly, it.failing will also be broken 😢
@jmasukawa @chrispyliang Fixed in #325
released in https://www.npmjs.com/package/jest-preview/v/0.3.2-alpha.3
I will release 0.3.2 soon
v0.3.2 is out https://github.com/nvh95/jest-preview/releases/tag/v0.3.2
Thank you for addressing!