node:test always throws a "passed a callback but also returned a promise" error if async function used with context #47069
Labels
test_runner
Issues and PRs related to the test runner subsystem.
Version
18.15.0 (also affects the userland "test" module in 16.16)
Platform
Darwin J1.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64
Subsystem
test_harness
What steps will reproduce the bug?
CodeSandbox Demo
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
I expect the test to run.
What do you see instead?
If you remove the
t
argument, the test works, but witht
present the test always throws withERR_TEST_FAILURE
and a message ofpassed a callback but also returned a Promise
.Additional information
I think this might be an off by one error? If I remove the
- 1
from this line, the test works as expected.The text was updated successfully, but these errors were encountered: