pestphp / pest-plugin-watch

The Pest Plugin Watch
https://pestphp.com
MIT License
17 stars 10 forks source link

feat: add support for specifying watch directories #12

Closed owenvoke closed 3 years ago

owenvoke commented 3 years ago

This adds support for specifying additional directories to watch from the command line. It supports a comma-separated list of directories. For example:

pest --watch --watch-dirs=database/factories,resources/fonts
nunomaduro commented 3 years ago

Can you explain the use case?

owenvoke commented 3 years ago

By default we watch the app, src, and tests directories. However, you may want to run tests when something changes in the database directory (such as a factory) or if you store code under another directory such as lib. So you could then do pest --watch --watch-dirs=database/factories and it would watch that as well. It supports comma-separated lists, or multiple flags.

nunomaduro commented 3 years ago

Hummm, you can you make the --watch option take those folders?


pest --watch
pest --watch=database/factories
owenvoke commented 3 years ago

Ah, makes sense. 👍🏻 On another note, do you think it should merge them with the defaults, or override them?

So if you do --watch=lib it would only watch lib rather than app, src, tests and lib.

nunomaduro commented 3 years ago

override them.

owenvoke commented 3 years ago

Will update this tomorrow. 🥳

owenvoke commented 3 years ago

@nunomaduro, does this look ok? It's kind of a complicated way of doing it, but matches the way the Coverage plugin works.

nunomaduro commented 3 years ago

If it works like this pest --watch=database/factories you can merge;