fork-ts-checker-webpack-plugin: Tests and app can get out of sync

First up - well done! I like this very much and thanks for https://github.com/TypeStrong/ts-loader/issues/537

However, I’ve found an issue when testing locally. I switched to use fork-ts-checker and deliberately broke the test code. I saw type errors and my tests failed. Great. Then I made some changes to my src code. The tests still failed. Great. Then I fixed the test code, the tests passed again. Awesome. Then I tweaked the src code and noticed the build was still reporting the type errors from when I deliberately broke the test. Nothing I do manages to let fork-ts-checker in on the news that the type error is gone. 😢

I’m guessing this is something to do with having my tests running in a separate process from my webpack build. My setup was based on this:

https://github.com/TypeStrong/ts-loader/tree/master/examples/webpack2-gulp-react-flux-babel-karma

with:

new ForkTsCheckerWebpackPlugin({
      watch: ['./src', './test'] // optional but improves performance (less stat calls)
})

Do you think if this an issue of my setup or is this a problem with fork-ts-checker? I’d be interested to see a setup as above tweaked to use fork-ts-checked in the correct manner assuming this is user error.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Okay - I’ve got a first version written: https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin

It’s published to npm: https://www.npmjs.com/package/fork-ts-checker-notifier-webpack-plugin

🍾

There’s one problem I’ve noted which could be:

  1. User error
  2. A bug in my notifier
  3. A bug in fork-ts-checker-webpack-plugin.

I’ll put up details in a while. Bedtime now I think. If you’ve any comments on the plugin then let me know.

I have a rough and ready plugin working. I’m going to do some more work on it and, if it seems worthwhile, I may publish it to npm. I may have some questions if that’s okay?

Here’s a repro project (based on one of ts-loader’s examples): https://github.com/johnnyreilly/fork-checker-repro

It has 2 commits; the initial setup and adding forktscheckerplugin so you can easily see what I’ve done. It’s a little hacked together but should allow you to repro the issue mentioned above.