test-runner
test-runner copied to clipboard
[Bug] "Jest did not exit one second after test run..." warning happens when image is fetched from a remote source
Describe the bug
It appears that when I use an image that is fetched from a source, it causes test-storybook to give the following warning:
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with
--detectOpenHandlesto troubleshoot this issue.
Steps to reproduce the behavior
- Create a brand new Storybook project using Typescript following the documentation.
- Add a new story with the following code:
import { Meta } from '@storybook/react';
export default {
title: 'Example/Image Test',
} as Meta;
export const WithAnImage = () => <img src="https://place-hold.it/350x150" alt="My CDN placeholder" />;
- Run
test-storybook - See error
Expected behavior
I expected the tests to complete without giving me this warning.
Screenshots and/or logs
Environment
- OS: macOS Monterey 12.5
- Node.js version: v19.2.0
- NPM version: 8.19.3
- Browser (if applicable): Headless browser: chromium
- Browser version (if applicable): ??
- Device (if applicable): N/A
Additional context
When I use an image that is located in the public directory, I do not see this warning.
Having the same issue occasionally. I used --eject to get the jest config file and pass it detectOpenHandles: true but that didn't do anything, no extra messages were printed and jest just waits forever.
I tried using https://github.com/Raynos/leaked-handles to see if I could debug this further and got the following issue:
tcp handle leaked at one of:
at Object.fakeCreateConnection [as createConnection] ([...]/node_modules/leaked-handles/stacks.js:98:21)
at [...]/node_modules/playwright-core/lib/common/netUtils.js:39:33
at createSocket ([...]/node_modules/playwright-core/lib/common/netUtils.js:38:10)
at SocksProxy._handleDirect ([...]/node_modules/playwright-core/lib/common/socksProxy.js:343:55)
tcp stream {
fd: 67,
readable: true,
writable: true,
address: { address: '192.168.178.20', family: 'IPv4', port: 53972 },
serverAddr: null
}
This doesn't seem super useful, but i'll continue looking into it...
As a temporary solution, running the test-runner with --eject and setting forceExit: true forces jest to exit.
I'm with the same problem, but not exactly loaded a image.