Reputation: 1389
for my tests of some three.js code with karma and jasmine I try to load some testdata via URL however even though the url is available it always fails loading when I run karma with an error
beforeAll(function(done) {
var loader = new THREE.STLLoader();
loader.load( 'http://localhost/tests/testdata/cube_big.stl',
function ( geo ) {
... some code
done();
},
function(e){
console.log("progress");
console.log(e);
},
function(e){
console.log("error case");
console.log(e);
}
);
});
Funny thing is that via specrunner webpage of jasmine I can happily execute this in the browser and everything works nicely. Only if I use karma runner I get fails
Error in those cases is not very clear to me as it reads ProgressEvent{isTrusted: true}
Anybody an idea?
Upvotes: 0
Views: 182
Reputation: 31036
The problem is that STLLoader
internally uses FileLoader
which uses XMLHttpRequest
for file loading. This is a browser API and not supported in node.js
.
Upvotes: 2