Skip to content

🐛 Bug: cannot execute tests from FIFOs #5511

@alxndrsn

Description

@alxndrsn

Bug Report Checklist

  • I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
  • I have searched for related issues and issues with the faq label, but none matched my issue.
  • I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
  • I want to provide a PR to resolve this

Expected

$ npx mocha --preserve-symlinks <(echo 'it("t", () => require("node:assert").equal(1, 1))')


  ✔ t

  1 passing (1ms)

Actual

$ npx mocha --preserve-symlinks <(echo 'it("t", () => require("node:assert").equal(1, 1))')

 Exception during run: Error: ENOTDIR: not a directory, scandir '/dev/fd/63'
    at Object.readdirSync (node:fs:1584:26)
    at lookupFiles (node_modules/mocha/lib/cli/lookup-files.js:116:6)
    at node_modules/mocha/lib/cli/collect-files.js:37:39
    at Array.reduce (<anonymous>)
    at module.exports (node_modules/mocha/lib/cli/collect-files.js:35:26)
    at singleRun (node_modules/mocha/lib/cli/run-helpers.js:152:29)
    at exports.runMocha (node_modules/mocha/lib/cli/run-helpers.js:239:10)
    at exports.handler (node_modules/mocha/lib/cli/run.js:375:11)
    at node_modules/yargs/build/index.cjs:443:71 {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '/dev/fd/63'
}

Minimal, Reproducible Example

npx mocha --preserve-symlinks <(echo 'it("t", () => require("node:assert").equal(1, 1))')

Versions

$ npx mocha --version
11.7.4
$ node --version
v24.10.0
$ echo $BASH_VERSION
5.2.21(1)-release

Additional Info

Alternative repro:

(rm asdf; mkfifo asdf) && (npx mocha asdf & echo 'it("t", () => require("node:assert").equal(1, 1))' > asdf)

And another:

echo 'it("t", () => require("node:assert").equal(1, 1))' | npx mocha --preserve-symlinks /dev/stdin

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: in triagea maintainer should (re-)triage (review) this issuetype: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions