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]: Test error in node 18.6.0 #165

Closed
1 of 2 tasks
fanhaoyuan opened this issue Jul 15, 2022 · 1 comment
Closed
1 of 2 tasks

[Bug]: Test error in node 18.6.0 #165

fanhaoyuan opened this issue Jul 15, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@fanhaoyuan
Copy link
Owner

fanhaoyuan commented Jul 15, 2022

Environment

  • NodeJS
  • Browsers

Version

18.6.0

Reproduction

(async function test() {
    let index = 0;
    let text = '';
    const cof = 1000;
    const length = 1_000_000;

    let readableStream;

    // eslint-disable-next-line no-implicit-coercion
    if (!isNaN(+length)) {
        while (text.length < length) {
            text += Math.random().toString(36).slice(-5);
        }

        readableStream = new ReadableStream<string>({
            start(controller) {
                (function push() {
                    const currentText = text.slice(index * cof, (index + 1) * cof);

                    if (!currentText) {
                        controller.close();
                        return;
                    }

                    index++;

                    controller.enqueue(currentText);
                    push();
                })();
            },
        });
    }
    // Success in 18.5.0, but fail in 18.6.0
    const data = await new Response(readableStream).text();

    expect(text).toBe(data);
})();

Expected behavior

Success run test

Actual behavior

TypeError: The "input" argument must be an instance of ArrayBuffer or ArrayBufferView. Received type string ('jelyiocpjfg2b0epejohurnu...)

Additional information

https://github.com/fatcherjs/fatcher/blob/master/packages/progress/__tests__/customName.spec.ts#L35
https://github.com/fatcherjs/fatcher/blob/master/packages/progress/__tests__/progress.spec.ts#L31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant