Ava: --watch not working with typescript recipe

Created on 31 Jul 2018  路  8Comments  路  Source: avajs/ava

Im new to ava so I followed the generic setup and then the typescript recipe.

running ava finds the test.ts file nicely. but --watch doesn't work then.. whut?!

when renaming test.ts to test.js it does work;
when running ava --watch test.ts it also does work.

bug help wanted globbing watch-mode

Most helpful comment

Glad to hear, thanks @midgethoen.

All 8 comments

Oh nice find! I don't think the watcher provides the extensions to the file globber: https://github.com/avajs/ava/blob/3ac2a8f813947588832fccd065d160fc533cd75c/lib/watcher.js#L83

We also need to provide them to the watcher itself: https://github.com/avajs/ava/blob/3ac2a8f813947588832fccd065d160fc533cd75c/lib/cli.js#L237

@midgethoen would you be interested in working on this?

To be honest I was trying out several testing frameworks to see which appeals most to me. So I鈥檓 not even sure yet if this will be ava. However I have been wanting to contribute to open source for some time and the issue seems pretty straight forward.

I鈥檒l give it a go. Although I鈥檓 a bit occupied atm. So it might be in a litte while.

That sounds great @midgethoen. Though this is a bit of an embarrassing bug, we should tackle it before we do the 1.0 release.

I have some time tonight. Let's see how far I get :)

@midgethoen oh no, I stepped on your toes!

I got as far as https://github.com/avajs/ava/tree/watcher-custom-extensions. Perhaps you could test that with your setup if you still have it lying around? npm install avajs/ava#watcher-custom-extensions should do the trick.

If that works we just need some tests in test/integration/watcher. That's not particularly glamorous work though, so feel free to punt that back to me 馃槈

@midgethoen oh no, I stepped on your toes!

Ah, That's ok 馃榿

The fix works like a charm for me!

Glad to hear, thanks @midgethoen.

For future readers, my watcher initially only watched for changes in test files, but not in imported source files. I had to manually configure the sources key in my configuration:

"files": [
  "src/**/*.test.ts"
],
"sources": [
  "src/**/*.ts"
],
Was this page helpful?
0 / 5 - 0 ratings