Skip to content

🐛 Bug: watching files outside of CWD is broken #5355

@zsalzbank

Description

@zsalzbank

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

Prior to #5256, I was able to:

  • watch files outside of the CWD
  • watch files specified with an absolute path

I expect to still be able to do this.

Actual

I am only able to watch files inside the CWD, and they must be specified as relative paths to the CWD.

Minimal, Reproducible Example

MCVE: https://github.com/zsalzbank/mocha-watch-mcve

Versions

mocha: 11.2.2
node: v20.13.1
os: ubuntu
shell: bash

Additional Info

chokidar used to get passed the watchFiles, but now it only gets passed the current directory.

Metadata

Metadata

Assignees

Labels

area: integrationsrelated to working with 3rd party software (e.g., babel, typescript)semver-patchimplementation requires increase of "patch" version number; "bug fixes"status: accepting prsMocha can use your help with this one!type: 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