test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

[bug] Issue with open HTTP connections: Jest did not exit

Open RSWilli opened this issue 1 year ago • 0 comments

Describe the bug There seems to be a way that HTTP requests need to be handled when the tested story is requesting ressources.

The problem arised when I ran test runner against a published storybook (in my case served by a golang application). When running against the local vite dev instance everything worked fine, but with my golang application a message like "Jest did not exit one second after test run..." showed up at the end and test-runner did not exit.

For reproduction purposes I then served the files via the npm http-server which worked fine.

The only thing that I can think of is that by default the HTTP connection to the golang application is left open, and node's express library (used by vite dev and http-server) sends Connection: keep-alive with Keep-Alive: timeout=5 by default, meaning that the connections will close.

To Reproduce

I do not have a reproduction that doesn't involve a golang application yet.

System

  System:
    OS: Linux 6.1 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.4.0 - ~/.nvm/versions/node/v21.4.0/bin/node
    Yarn: 1.22.21 - /usr/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v21.4.0/bin/npm <----- active
  npmPackages:
    @storybook/addon-essentials: ^7.5.3 => 7.5.3 
    @storybook/addon-interactions: ^7.5.3 => 7.5.3 
    @storybook/addon-links: ^7.5.3 => 7.5.3 
    @storybook/addon-svelte-csf: ^4.0.12 => 4.0.12 
    @storybook/addon-themes: ^7.6.5 => 7.6.5 
    @storybook/blocks: ^7.5.3 => 7.5.3 
    @storybook/svelte: ^7.5.3 => 7.5.3 
    @storybook/sveltekit: ^7.5.3 => 7.5.3 
    @storybook/test-runner: ^0.16.0 => 0.16.0 
    @storybook/testing-library: ^0.2.2 => 0.2.2 
    eslint-plugin-storybook: ^0.6.15 => 0.6.15 
    storybook: ^7.5.3 => 7.5.3 

Additional context

Could be related to https://github.com/storybookjs/test-runner/issues/236 because the described reproduction also includes a link to an image that has Connection: keep-alive response headers

image

RSWilli avatar Dec 22 '23 09:12 RSWilli