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
{{ message }}
Repository navigation
With new node:test package, before/beforeEach/after/afterAll don't seem to work #44528
Linux davidpc 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
node:test
What steps will reproduce the bug?
I created the following code:
import{describe,it,before,beforeEach,after,afterEach}from'node:test';import*asassertfrom'node:assert';describe('Describe Container',function(){before(()=>{console.log('IN BEFORE')});beforeEach(()=>{console.log('IN BEFORE EACH')});it('should equal 1 and 1',()=>{assert.equal(1,1);});it('should equal 2 and 2',()=>{assert.equal(2,2);});after(()=>{console.log('IN AFTER')});afterEach(()=>{console.log('IN AFTER EACH')});});
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior?
Appropriate test output, with BEFORE, etc, messages printed
What do you see instead?
$ node --test test-before.mjs
TAP version 13
# Subtest: /home/david/Projects/nodejs/node-test/test-before.mjs
ok 1 - /home/david/Projects/nodejs/node-test/test-before.mjs
---
duration_ms: 0.074160944
...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 0.134743581
Activity
himself65 commentedon Sep 6, 2022
Refs: #44372
himself65 commentedon Sep 6, 2022
Closing as there are many duplicated issues like this