-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"nocache" option not working ? #2317
Comments
|
I'm sorry, but I can't see the difference ... Serving the files from the disk = should prevent caching as you will have the latest file. If this options is If not, that is really not clear for me |
I see your point. It makes sense to implement nocache headers in such scenarios. @dignifiedquire, do you think nocache headers in responses is something |
@kahwee It should be already the case, no ? If you look at my examples in the bottom of my first message : Setting I think this is broken (or an |
That does seem like a regression. |
@MLefebvreICO How do you get to this state where there are query parameter Yours:
I tried this:
What I've got in the source code of <script type="text/javascript" src="/base/fixtures/test.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="/base/fixtures/test2.js" crossorigin="anonymous"></script> |
I saw it while using |
@MLefebvreICO Can you paste over your 2 |
The only The Here is a screenshot : |
You should find it when you hit the "Debug" button. |
I have these two using Yandex Browser : <script type="text/javascript" src="/base/application.spec.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="/base/templates.js" crossorigin="anonymous"></script> I don't understand as PhantomJS clearly has tokens that comes with it, why would it be different with my browser ? I'm pretty sure PhantomJS does nothing on their end to add token after js scripts |
I have no idea. I don't get the same results as you. If you can provide a repository with minimum subset of files to reproduce this, I'll definitely take a look. I was fixing some stuff yesterday and wouldn't mind fixing this issue for you. |
Just chiming in that I'm seeing this as well. I only see it when on the default Karma window and inspecting the traffic (in the iFrame). I get the But if I go to the Debug window there is no |
I seemed to have found a possible culprit. In lib/middleware/karma.js there are these lines:
Which confirms what I was seeing that it was only happening with the iFrame (context.html). At this point the file object has no .sha on it, thus putting I have temporarily fixed this by changing the above if statement as such:
|
Use the most recently computed file sha present on the served file when setting the file sha in the scripts tags added to the context.html. This fixes an issue where the sha query arg would always be the sha of the file when karma initially started and would not take into account changes to the file when the watcher is running. Closes karma-runner#2317, karma-runner#2264
Use the most recently computed file sha present on the served file when setting the file sha in the scripts tags added to the context.html. This fixes an issue where the sha query arg would always be the sha of the file when karma initially started and would not take into account changes to the file when the watcher is running. Closes karma-runner#2317, karma-runner#2264
Use the most recently computed file sha present on the served file when setting the file sha in the scripts tags added to the context.html. This fixes an issue where the sha query arg would always be the sha of the file when karma initially started and would not take into account changes to the file when the watcher is running. This may also address the issues in karma-runner#2317 and karma-runner#2264
Expected behavior
It should prevent the browser to use cached files marked with
nocache
option set totrue
Actual behavior
It is not preventing the browser to use cached files marked with
nocache
option set totrue
Enviroment Details
karma --version
): 1.1.2karma.config.js
file :Steps to reproduce the behaviour
nocache: true
on some files/globsingleRun=false
Also, I noticed when using
PhantomJS
that when not passing thenocache
option, it will add a token next to the filename. Example :application.spec.js?a1b2c3d4f5g6
.This token will not change unless we restart karma.
Putting the
nocache
option totrue
, the token will beundefined
(application.spec.js?undefined
) so maybe that's what's causing that cache issue ?I would expect instead that there's a token and each time the test suite start it replaces that token with a new one, preventing cached files to be used.
The text was updated successfully, but these errors were encountered: