I am using java to run Envjs in order to run javascript unit tests in Jasmine. This will allow me to run the tests without a browser and make it easier to integrate into Jenkins (a continuous integration build server).
I have a LoadSpecRunner.js file (that Envjs runs) that just loads the actual jasmine test runner, using code like below.
window.location.href = 'file:///c:/source/JasmineTest/SpecRunner.html');
The problem is that setting the full url to the file works fine, whereas all my attempts at setting a relative path have failed. Following are some of my attempts at setting a relative url at the output returned
window.location.href = Envjs.uri('../JasmineTest/SpecRunner.html');
or
window.location.href = '../JasmineTest/SpecRunner.html';
failed to open file file://c/source/JasmineTest/SpecRunner.html
Java Exception: java.net.UnknownHostException: c
window.location.href = window.location.href;
failed to open file file://c/:/Source/jasmine-reporters/about:blank
JavaException: java.net.UnknownHostException: c
Does anybody have any ideas?
Thanks
Cedd
PS. Further reading on what I am trying to do:
http://skaug.no/ingvald/2010/10/javascript_unit_testing/
http://www.build-doctor.com/2010/12/08/javascript-bdd-jasmine/
I met same problem and resolved it by modify env.rhino.1.2.js:
if (!base) {
base = 'file://' + Envjs.getcwd() + '/';
}
->
if (!base) {
base = 'file:///' + Envjs.getcwd() + '/';
}