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 runner: async callbacks passed to describe are note awaited #48845

Closed
alcuadrado opened this issue Jul 19, 2023 · 1 comment · Fixed by #48856
Closed

test runner: async callbacks passed to describe are note awaited #48845

alcuadrado opened this issue Jul 19, 2023 · 1 comment · Fixed by #48856
Labels
test_runner Issues and PRs related to the test runner subsystem.

Comments

@alcuadrado
Copy link

Version

v20.4.0

Platform

Darwin lucille.lan 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020 arm64

Subsystem

test runner

What steps will reproduce the bug?

Running this with node --test leads to the error "test could not be started because its parent finished"

import { describe, it } from "node:test";

describe("describe", async () => {
  await new Promise((resolve) => setTimeout(resolve, 10));

  it("it inside describe", async () => {});
});

How often does it reproduce? Is there a required condition?

It's deterministic.

What is the expected behavior? Why is that the expected behavior?

describe's documentation indicates that an async function can be passed, so it should be awaited.

What do you see instead?

I get the error test could not be started because its parent finished.

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the test_runner Issues and PRs related to the test runner subsystem. label Jul 20, 2023
@alcuadrado
Copy link
Author

Thanks for fixing it so quickly, @rluvaton!

jaydenseric added a commit to jaydenseric/next-graphql-react that referenced this issue Nov 21, 2023
…irector`.

Note that the tests won’t run properly in Node.js v18 until the fix for this Node.js test runner bug is published in a v18 release:

nodejs/node#48845
jaydenseric added a commit to jaydenseric/next-graphql-react that referenced this issue Nov 21, 2023
TODO: Re-enable these tests in Node.js v18 once the fix for this Node.js test runner bug is published in a v18 release:

nodejs/node#48845

The Node.js v18.19.0 release is scheduled for 2023-11-28:

nodejs/Release#737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants