avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Change in source file doesn't trigger test run in watch mode when started with test selection #1264

Closed hoschi closed 4 years ago

hoschi commented 7 years ago

run ava -w src/widgets/**/*.test.js and AVA starts in watch mode and should rerun depending tests when changing a source file (e.g. src/widgets/MyWidgets.js).

This only works on Mac and not on Linux/Windows because of a chockidar bug. In short the bug here is that the pattern which says which tests should be run is more special as default pattern for source files or configured in package.json (e.g. source: 'src/*/.js').

Before version 0.18.0 users could add additional sources by the --sources flag: ava -w -S src/widgets/**/*.js src/widgets/**/*.test.js If you run into that problem you can probably downgrade AVA to 0.17.0 and run with that solution.

Complete discussion on gitter: https://gitter.im/avajs/ava?at=58a405adf045df0a224cfb18

novemberborn commented 7 years ago

The default src/**/*.js pattern is ignored by Chokidar because of the src/widgets/**/*.test.js pattern. This is fundamentally a Chokidar bug, so if anybody can help out that'd be great.

In the meantime I suppose we could clean up the patterns we pass to Chokidar and remove more specific ones if they're already covered by a generic pattern. I'm not sure if tools for that already exist, @sindresorhus? This may be easier than fixing Chokidar though.

sindresorhus commented 7 years ago

I'm not sure if tools for that already exist, @sindresorhus?

Not that I'm aware of.