Skip to content

ert78gb/node-22-test-runner-async-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

This repository is for reproduce node --test async before, beforeEach afterEach and after hooks running order issue.

The test case starts executing befor the before hook is finished. In node 21 everything works as expected.

Steps to reproduce

  • clone the repository
  • install node 22.0.0
  • run npm install
  • run npm test

Expected behavior

The console log should be:

before start
before end
beforeEach start
beforeEach end
test case start
test case end
afterEach start
afterEach end
after start
after end

Instead, the console log is:

before start
beforeEach start << "beforEach" strarts before "before end"
before end
beforeEach end
test case start
test case end
afterEach start
afterEach end
after start
after end

In earlier node version the await keyword helped before the hooks but in node 22.0.0 it doesn't work.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published