Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ BUG ] streamToPromise does not propagate read stream errors #425

Closed
huntharo opened this issue May 21, 2024 · 2 comments · Fixed by #426 · May be fixed by tbreeze-zengenti/react-starter#3
Closed

[ BUG ] streamToPromise does not propagate read stream errors #425

huntharo opened this issue May 21, 2024 · 2 comments · Fixed by #426 · May be fixed by tbreeze-zengenti/react-starter#3

Comments

@huntharo
Copy link
Contributor

Describe the bug

streamToPromise does not propagate a read stream error and instead just stalls, causing programs to hang.

Expected behavior

  • There should be a test that proves that this works
  • The error should propagate
  • Additionally, the documentation on the method should be updated to make it clear that the method consumes the stream, holds it in memory, and awaits the stream to finish

Context:

  • Library Version 7.1.1

Additional context

None

@huntharo
Copy link
Contributor Author

Failing test case added that shows how the test just hangs:

    ✕ streamToPromise propagates error on read stream (5001 ms)

  ● sitemap stream › streamToPromise propagates error on read stream

    ENOENT: no such file or directory, open '/var/folders/07/183kkj1d7l59l67s4tq0dmyr0000gn/T/does-not-exist-sitemap.xml'



  ● sitemap stream › streamToPromise propagates error on read stream

    thrown: "Exceeded timeout of 5000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

       97 |   });
       98 |
    >  99 |   it('streamToPromise propagates error on read stream', async () => {
          |   ^
      100 |     await expect(
      101 |       streamToPromise(
      102 |         createReadStream(resolve(tmpdir(), `./does-not-exist-sitemap.xml`))

      at it (tests/sitemap-stream.test.ts:99:3)
      at Object.describe (tests/sitemap-stream.test.ts:17:1)

@huntharo
Copy link
Contributor Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment