AnonyMouse
AnonyMouse

Reputation: 18630

Qunit changes to test script not being picked up

I set up a new QUnit solution:

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <title>QUnit Example</title>
      <link rel="stylesheet" href="/resources/css/qunit.css">
    </head>
    <body>
      /h1>
    <h2 id="qunit-banner">
    </h2>
    <h2 id="qunit-userAgent"></h2>
    <ol id="qunit-tests">
    </ol>
      <script src="/resources/js/qunit.js"></script>
      <script src="/resources/tests.js"></script>
    </body>

</html>

I have a test in my tests.js script file:

test( "hello test", function() {
  ok( 1 == "1", "Passed!" );
});

The test passes, so this setup works.

However when I make changes to tests.js, they are not being picked up. For instance, if I add a test, it is not being run. The only way to make the test run is to rename tests.js to something else, say tests2.js, and update the reference. The changes are then picked up.

Anyone know what's going on and how to fix this so I don't need to keep updating the reference and changing the filename?

Upvotes: 2

Views: 330

Answers (1)

stinkycheeseman
stinkycheeseman

Reputation: 45747

I experience a similar problem. It's due to caching. One solution would be to hard refresh your page a bunch of times after every change or just empty the cache. Another would be to add revision numbers to your files so they are freshly loaded every time: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

Upvotes: 1

Related Questions