karma-systemjs icon indicating copy to clipboard operation
karma-systemjs copied to clipboard

karma-systemjs Cache Busting Extension

Open dbabaioff opened this issue 8 years ago • 8 comments

Based on this discussion https://github.com/systemjs/systemjs/issues/172, I'm trying to implement a cache busting extension for karma-systemjs. There is a doc page (https://github.com/ModuleLoader/es6-module-loader/blob/master/docs/loader-extensions.md#custom-extension-example---cache-busting-extension) showig how to extend the ES6 loader.

How can I implement this using karma-systemjs?

dbabaioff avatar Jul 05 '15 09:07 dbabaioff

As long as you're not changing the path, just adding query parameters, it should work the exact same way. Just add your hook to your config file and it'll get used by SystemJS when it calls System.import().

I'm surprised you need cache busting with karma-systemjs. Are your karma tests having caching problems?

rolaveric avatar Jul 05 '15 10:07 rolaveric

Yes. Only if I kill the karma server my changes take effect. (I'm using webstorm to run my tests) I just tried the cache busting, but still getting cached files. Do you have an idea what can be? It started after using karma-systemjs, before was working fine..

dbabaioff avatar Jul 05 '15 10:07 dbabaioff

Hmmmm. I always assumed Karma browser launchers specify switches to disable caching in the browsers. I'll need to try and replicate it locally. Can you supply a github project that reproduces it? What browser are you using?

rolaveric avatar Jul 05 '15 11:07 rolaveric

I tryied on PhantomJS and Chrome. I'll give you the github repo later..

dbabaioff avatar Jul 05 '15 12:07 dbabaioff

@rolaveric , you can use any sample in https://github.com/unional/karma-systemjs-sample All three of them are working on command line but have the cache problem when runing in webStorm / phpStorm.

I'm also eagerly looking for this functionality.

Thanks,

unional avatar Jul 12 '15 21:07 unional

Thanks @unional Right, so the problem is specific to Webstorm/IntelliJ. Sorry, despite using Webstorm I tend to use the command line, or at most use grunt or gulp tasks, so I've never seen this before. Very weird. I'll dig into the intellij karma launcher and see what I can find.

rolaveric avatar Jul 25 '15 01:07 rolaveric

Sorry I haven't had much time to look into this issue, and I'm not quite sure where to start other than digging through the IntelliJ plugin code. If anyone has any ideas or can spend some time looking into the issue, that'd be greatly appreciated.

rolaveric avatar Sep 05 '15 23:09 rolaveric

Seems similar to this one: https://youtrack.jetbrains.com/issue/WEB-12496

In this issue a possible workaround is suggested, which does seem to work for me. (On windows: adjusting the refresh property in C:\Program Files (x86)\JetBrains\WebStorm 11.0.3\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js )

piebe avatar Mar 01 '16 10:03 piebe