avajs / typescript

Test TypeScript projects using AVA.
MIT License
73 stars 16 forks source link

Investigate watcher interactions #7

Closed novemberborn closed 4 years ago

novemberborn commented 4 years ago

AVA's watcher may be watching both source files and the TypeScript build output. It must watch the source files, otherwise it won't know to rerun tests. But there's no point in rerunning tests until the build output has changed.

Delaying the watcher may work but this is not configurable. Perhaps if the watcher could figure out it should wait for a rewritten path to be updated too that may work. It'll require changes to how AVA and this package interact.

novemberborn commented 4 years ago

Worse, of course, is that this breaks dependency tracking in the watcher. The loaded files will be from the build output, so AVA doesn't realize build files are dependencies of test files.

If AVA could perform the path rewrites (or maybe invert them), it could track dependencies correctly.

Combine that with knowing to wait for the build output of a specific test file to change and we're close to having a functional watcher again.

Users should then configure AVA to ignore non-test file updates of sources, so that it's purely watching the build output.

jaapz commented 4 years ago

I think it would be nice if ava would use the watcher on the actual test files to decide which test to rerun, but only rerun those once the build files have also actually changed. That would be the result I would expect (even though all tests are technically rebuilt).

Currently the --watch flag with precompiled builds is not very useful.

Maybe ava could even have support for executing the precompilation step?

novemberborn commented 4 years ago

I think it would be nice if ava would use the watcher on the actual test files to decide which test to rerun, but only rerun those once the build files have also actually changed. That would be the result I would expect (even though all tests are technically rebuilt).

Yes, that's what this issue is about.

Maybe ava could even have support for executing the precompilation step?

See #3.

novemberborn commented 4 years ago

Fixed by https://github.com/avajs/typescript/pull/11.