Karma runner doesn't recognize transpiled code change till second run

I am using Karma with Typescript.   A gulp task watches for .ts file changes and compiles to .js, including our spec files.    When I run Karma, no matter how long it is after the spec file has been modified and transpiled, the Karma runner will never pick up on the changes the first time.   I always have to run Karma twice to pick up on my changes.

I have tried it with autoWatch enabled and disabled and with singleRun enabled and disabled and combinations thereof with no change in behavior.

Alternately, I can stop the Karma server from the IDE and it will see the changes at that point but it's a hassle.

Thoughts?

5 comments
Comment actions Permalink

Seems the IDE virtual file system is not synchronized, so the generated files are not visible to the IDE and thus aren't uploaded to server. Do you run Gulp from within WebStorm? Do you use 'watch' task, or run Gulp explicitly? Are you using karma-browserify? karma-jspm?

0
Comment actions Permalink

I tend to run gulp a variety of ways depending on what I'm doing.   I may launch our default gulp task from WebStorm and then run Karma from within WebStorm.  Other times I'll run gulp from a terminal window.  Sometimes I'll run dfferent gulp tasks in different terminal windows (I'm not aware of a way to run multiple long running gulp tasks in webstorm).   If it will watch the files better, I'll try to run the gulp tasks from WebStorm task runner but I haven't seen any documentation that states that it was necessary to do so.

0
Comment actions Permalink

Files produced by external process won't be available to WebStorm, so you need running Gulp from the IDE to make this work. Unfortunately results of Gulp watch running are not currently synchronized even when running it from IDE (https://youtrack.jetbrains.com/issue/WEB-14873)

0
Comment actions Permalink

@ Richard Collette Have managed to fix it somehow? And yes, I also use Karma with Browserify for transpiling. Reproduced with WebStorm 2017.1.1

0
Comment actions Permalink

@Orestprustayko your issue is likely different. Please see https://youtrack.jetbrains.com/issue/WEB-12496#comment=27-1946429 for possible workaround

0

Please sign in to leave a comment.