Skip to content

async error inside before won't cause test error #52399

@himself65

Description

@himself65

Version

18, 20, 21

Platform

macos 14

Subsystem

test_runner

What steps will reproduce the bug?

import { before, test } from 'node:test'
import { createWriteStream } from 'node:fs'

before(() => {
  const fsStream = createWriteStream(new URL('./not-exist/file.txt', import.meta.url), {
    encoding: 'utf8'
  })

  fsStream.write('Hello World')
  fsStream.end()
})

test('ok', () => {

})

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

No response

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

No response

What do you see instead?

node --test node-js-fs-stream.mjs
✔ ok (1.033833ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 43.30675

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions