jsUnit based tests won't run in other folders?

A fix for jsUnit tests not running in external folders.

This is why software is such a sometimes frustrating undertaking. I once had a jsUnit based test working. It ran fine in FireFox. Today it did not. Funny thing is that the existing tests that come with jsUnit still work. Other browsers fail too. (maybe).

It had to be a typo, bad url, or something. The jsUnit docs say that the problem is that I am not correctly giving the path to the jsUnitCore.js file. I tried everything. But, now I try to get smart. First copy the tests that are working to another folder. I copy failingTest.html to /temp/jsunit, and I also copy jsUnitCore.js there too.
Still doesn’t work.

I edit jsUnitCore.js, and add an alert to show that it is being executed or loaded. To make sure I really did it, I diff:

C:tempjsunit>diff failingTest.html javajsunittestsfailingTest.html

<     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<     <script type="text/javascript" src="./jsUnitCore.js"></script>
>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>     <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
>     <script type="text/javascript" src="../app/jsUnitCore.js"></script>

C:tempjsunit>diff jsUnitCore.js javajsunitappjsUnitCore.js

< alert("Maybe a career in sanitation?");

Try the test and I see the message. So, I know that the library is being found and is running. That is weird. Must be the browser. I empty the cache. still nothing. Arrrrr.

Google? I find a reference to jsUnit forum about someone having a similar problem. No advice, but one person gives a url for the solution. Is it a good url, spam, or worse? Nope its legit, and real advice. It is the browser. Thank you Andrew! I should have checked the forum first.

Browsers, bah! I hope they don’t start showing up in embedded systems. That’s probably how WWIII will get started, some Javascript mistyping.

17JAN11: Spoke too soon. FireFox ver 4.0b9 is showing the problem again. I’ll try in my Ubuntu instance too.

JSUnit 2.2 on Firefox 3.07 – FTW


Leave a Reply

Your email address will not be published. Required fields are marked *