hspec/sensei

Only watch .hs and .lhs files

sol opened this issue · 9 comments

sol commented

I'm considering to make his change. Please raise your voice if you have an option on it.

supki commented

I find reloads on changes to .cabal files useful, too.

Also, ideally, sensei would reload on changes to the files added by addDependentFile, although I don't know if it's possible to easily get them from GHC currently.

sensei does not consider the cabal file, does it? So it shouldn't behave differently before and after changes to the cabal file. Or am I missing something?

supki commented

It does reload the spec for me when I change the project's cabal file. (I'm on 9545f0a.)

AFAIU sensei currently watches all the files in the directory. If anything changes, it re-runs the test-suite. So if you have a completely unrelated file (say foo.txt) and you change that, sensei will re-run the test-suite, but you will always get the same result. (Assuming your test-suite doesn't read foo.txt.)

The same is true for the cabal file. sensei is using ghci under the hood, which doesn't look at the cabal file. So, if you change the cabal file, sensei will re-run the test-suite, but the result will always be the same. (Assuming your test-suite doesn't read the cabal file.)

At least that's my understanding. Did you encounter a situation, where you changed something in the cabal file and then got a different result from sensei than before the change?

supki commented

Oh. Yeah, you're right, the reload doesn't change anything. Nevermind then, I don't have any objections to watching for changes in *.hs and *.lhs files only.

It would be useful, at least, to have command line options to include or exclude files, maybe by regular expression match. Currently if you have other utilities watching the project directory, and if they end up modifying a file that isn't isBoring, it can cause sensei to run tests multiple times.

sol commented

@adrusi #43 will ignore everything that is ignored by git. I think this will already help in many situation.

However, situations where e.g. a test suite records files that are then subsequently committed can still result in looping behavior. I'm inclined to add support for .sensei.boring to address this.

sol commented

I'm not planning to do anything here at this point as .gitignore addresses my needs.