You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux workstation 5.19.0-46-generic #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 21 15:35:31 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
test_runner
What steps will reproduce the bug?
Create a file named runner.js with the following content:
import{describe,it,run}from'node:test'importospathfrom'node:path'import{fileURLToPath}from'node:url'importassertfrom'node:assert'const__filename=fileURLToPath(import.meta.url)const__dirname=ospath.dirname(__filename)construnTests=async()=>{consttestFile=ospath.join(__dirname,'test.js')consttestsStream=run({files: [testFile],})forawait(consteventoftestsStream){console.log(event)}return{total: 0,}}describe('test',()=>{it('should run node:run',async()=>{constr=awaitrunTests()assert.equal(r.total,0)})})
Create a file named test.js with the following content:
test at file:/home/guillaume/Workspace/opensource/asciidoc-tck/runner.js:23:3
✖ should run node:run (2.247107ms)
'Promise resolution is still pending but the event loop has already resolved'
test at file:/home/guillaume/Workspace/opensource/asciidoc-tck/runner.js:22:1
✖ test (2.410128ms)
'Promise resolution is still pending but the event loop has already resolved'
How often does it reproduce? Is there a required condition?
Always.
No, as long as you are using Node 20.12.0.
What is the expected behavior? Why is that the expected behavior?
The code should not throw "Promise resolution is still pending but the event loop has already resolved".
With Node 20.11.0, here's the result:
Is there a solution that could allow me to test a tool that relies on the test_runner module? In my opinion, being able to use the test_runner module as a library is a great feature.
For reference, I've introduced an "index.js" file since node without the --test argument cannot execute multiple files from the CLI (i.e., node tests/**.js -> node tests/index.js).
Version
Platform
Subsystem
What steps will reproduce the bug?
Create a file named
runner.js
with the following content:Create a file named
test.js
with the following content:Run:
Output
How often does it reproduce? Is there a required condition?
Always.
No, as long as you are using Node 20.12.0.
What is the expected behavior? Why is that the expected behavior?
The code should not throw "Promise resolution is still pending but the event loop has already resolved".
With Node 20.11.0, here's the result:
Output
What do you see instead?
An exception: "Promise resolution is still pending but the event loop has already resolved".
Additional information
When using Node 20.11.0 or lower it's working.
If I remove (or comment) the following code then it works with Node 20.12.0:
I'm using
node:test
to create a Technology Compatibility Kit (TCK) and I also usenode:test
to test my TCK.The text was updated successfully, but these errors were encountered: