rolaveric / karma-systemjs

Karma plugin for using SystemJS as a module loader
MIT License
40 stars 19 forks source link

karma-systemjs Cache Busting Extension #26

Open dbabaioff opened 9 years ago

dbabaioff commented 9 years ago

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?

rolaveric commented 9 years ago

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?

dbabaioff commented 9 years ago

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..

rolaveric commented 9 years ago

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?

dbabaioff commented 9 years ago

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

unional commented 9 years ago

@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,

rolaveric commented 9 years ago

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 commented 9 years ago

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.

piebe commented 8 years ago

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 )