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

test(async): improve test coverage #4567

Merged
merged 4 commits into from Apr 11, 2024
Merged

Conversation

mbhrznr
Copy link
Contributor

@mbhrznr mbhrznr commented Apr 10, 2024

working towards #3713.
pushes code coverage of the async sub-module closer to 100%.

the two remaining files in the sub-module which aren't at 100% are:

  • mux_async_iterator.ts:
    resetting the errors via this.#throws.length = 0 seems to be unreachable code.
    if we have a truthy value for this.#throws.length we would throw all of the errors, thus exiting iterate.
  • pool.ts:
    the catch block as well as the error handling seems to be covered by tests already.

@mbhrznr mbhrznr requested a review from kt3k as a code owner April 10, 2024 21:29
@github-actions github-actions bot added the async label Apr 10, 2024
Copy link
Collaborator

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Nicely done! I have just a couple of nits. Let's also remove the unreachable code from mux_async_iterator.ts.

@@ -22,7 +22,7 @@ Deno.test("pooledMap()", async function () {
assert(diff < 3000);
});

Deno.test("pooledMap() handles errors", async () => {
Deno.test("pooledMap() handles errors", async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: we generally use the arrow syntax for anonymous functions. Please revert. Ditto elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

understood! also took liberty to convert the other test cases in the async sub-module to make use of the arrow syntax as well.

async/delay_test.ts Outdated Show resolved Hide resolved
@mbhrznr mbhrznr requested a review from iuioiua April 11, 2024 20:43
Copy link
Collaborator

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

LGTM! Good stuff. Thank you.

@iuioiua iuioiua merged commit 61183bc into denoland:main Apr 11, 2024
13 checks passed
@mbhrznr mbhrznr deleted the test/async branch May 13, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants