-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
area: node.jscommand-line-or-Node.js-specificcommand-line-or-Node.js-specificstatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Description
Under certain circumstances Mocha fails to reload source files in watch mode. Specifically, if a file is watched and modified but only required by a file that is not watched then the modified file is not reloaded and the change is not visible to the test suite.
This issue can be addressed by adding the unwatched files to --watch-files
Steps to Reproduce
Create the following three files
// lib-a/index.js
module.exports = true// lib-b/index.js
module.exports = require('../lib-a')// test/main.js
const assert = require('assert')
const value = require('../lib-b')
it('works', function () {
assert(value)
})Now run
mocha --watch --watch-files lib-a,testThe test suite passes.
Now modify lib-a/index.js so that the exported value is false. This will retrigger the tests but they will still succeed.
If lib-b is add to the --watch-files list then the modification results in a test failure.
diidiiman and nsreed
Metadata
Metadata
Assignees
Labels
area: node.jscommand-line-or-Node.js-specificcommand-line-or-Node.js-specificstatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Type
Projects
Status
No status