Watch mode overwrites the test file
Hi, I've been using this awesome package for some time to my satisfaction, but now I've stumbled upon an issue with the latest version. It manifests in this repo: https://github.com/naja-js/naja. If I run yarn run test locally, it runs karma in watch mode (with autoWatch: true, singleRun: false), the tests get stuck in an endless loop where it keeps detecting a change in the tests/index.js. When I manage to exit the loop, the tests/index.js is indeed modified – it is either empty, or it contains the generated bundle.
Downgrading this package to 7.0.7 helps, so I'm guessing it's somehow connected to #72 / #74. Is this a bug? Or should I change the configuration in some way? Thanks for your help!
Hey! I wanted to leave a note that I was seeing the same behavior of an endless loop of re-writing and watching the tests file when autoWatch: true, singleRun: false. I also implemented a quick fix of downgrading to 7.0.7 and am investigating locally.
@jlmakes any chance you could have a look please? :)
We hit this issue as well and downgrading resolved the problem. (Internal project, no link to share)
I see, that's no good! Roping @YonatanKra into this conversation. Let's see if we can get this fixed, thanks for the report.
I've looked into this one and here is what I found.
-
The changes made for #72 introduced this issue.
-
rollup.watchis used instead ofrollup.rollup.rollup.watchalso writes directly to the file system, resulting in this issue. -
I think that the root cause of #72 is in
@rollup/plugin-typescriptwhen usingrollup.rollup(i.e. watchMode is false) -
I created an issue in
@rollup/plugin-typescriptrollup/plugins#1354 -
I also created a pull request in
@rollup/plugin-typescripthttps://github.com/rollup/plugins/pull/1356.
Once rollup/plugins#1354 is fixed and released, the fix for #72 could be reverted and everything should work as expected when using the official Typescript plugin.
The pull request for @rollup/plugin-typescript was approved and released as part of version 10.0.1.
I created a pull request #76 to revert the changes that introduced this issue and added a basic test case.
@jlmakes
@jlmakes LMK if you think the change can be integrated
@jlmakes would you consider releasing a new version with this fix? The current v7.0.8 has this issue...
@jlmakes friendly ping!