Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(test): typo ('finsihed') if text decoder not closed during test #14996

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

nkronlage
Copy link
Contributor

Fixes a typo when running:

Deno.test("break during stream read", async () => {                                     
  const stream = new ReadableStream({                                                   
    start(controller) {                                                                 
      controller.enqueue(new Uint8Array([65]));                                         
      controller.enqueue(new Uint8Array([66]));                                         
      controller.close();                                                               
    }                                                                                   
  }).pipeThrough(new TextDecoderStream());                                              
                                                                                        
  for await (const chunk of stream) {                                                                                             
    console.log(chunk);                                                                 
    break;                                                                              
  }                                                                                     
});  

Output Before:

> deno test ~/deno-text-decoder-test-fail.ts               
running 1 test from ../../deno-text-decoder-test-fail.ts
break during stream read ...
------- output -------
A
----- output end -----
break during stream read ... FAILED (17ms)

 ERRORS 

break during stream read => ../../deno-text-decoder-test-fail.ts:1:6
error: AssertionError: Test case is leaking 1 resource:

 - A text decoder (rid 3) was created during the test, but not finsihed during the test. Close the text decoder by calling `textDecoder.decode('')` or `await textDecoderStream.readable.cancel()`.

    at assert (deno:ext/web/00_infra.js:294:13)
    at resourceSanitizer (deno:runtime/js/40_testing.js:414:7)
    at async Object.exitSanitizer [as fn] (deno:runtime/js/40_testing.js:432:9)
    at async runTest (deno:runtime/js/40_testing.js:813:7)
    at async Object.runTests (deno:runtime/js/40_testing.js:1095:22)

 FAILURES 

break during stream read => ../../deno-text-decoder-test-fail.ts:1:6

FAILED | 0 passed | 1 failed (42ms)

error: Test failed

Output After:

> ./target/debug/deno test ~/deno-text-decoder-test-fail.ts
running 1 test from ../../deno-text-decoder-test-fail.ts
break during stream read ...
------- output -------
A
----- output end -----
break during stream read ... FAILED (22ms)

 ERRORS 

break during stream read => ../../deno-text-decoder-test-fail.ts:1:6
error: AssertionError: Test case is leaking 1 resource:

 - A text decoder (rid 3) was created during the test, but not finished during the test. Close the text decoder by calling `textDecoder.decode('')` or `await textDecoderStream.readable.cancel()`.

    at assert (deno:ext/web/00_infra.js:294:13)
    at resourceSanitizer (deno:runtime/js/40_testing.js:414:7)
    at async Object.exitSanitizer [as fn] (deno:runtime/js/40_testing.js:432:9)
    at async runTest (deno:runtime/js/40_testing.js:822:7)
    at async Object.runTests (deno:runtime/js/40_testing.js:1111:22)

 FAILURES 

break during stream read => ../../deno-text-decoder-test-fail.ts:1:6

FAILED | 0 passed | 1 failed (59ms)

error: Test failed

@CLAassistant
Copy link

CLAassistant commented Jun 28, 2022

CLA assistant check
All committers have signed the CLA.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 28, 2022

Can you please sign the CLA. Also, is the before and after output the same in your snippets?

@nkronlage
Copy link
Contributor Author

Just signed the CLA.

The output is different where is says ... not finsihed during... in the before and ... not finished during... in the after (s and i swapped places)

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if the CI passes.

@cjihrig cjihrig merged commit 4e4d987 into denoland:main Jun 28, 2022
dsherret pushed a commit to dsherret/deno that referenced this pull request Jun 30, 2022
…enoland#14996)

fix: typo ('finsihed') if text decoder not closed during test
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants