aframe: Tests failing locally
I have test failing locally and can’t figure out why. Both on Chrome and Firefox. They seem to work on the repo test automation.
I narrowed down one of the issues. This test:
https://github.com/aframevr/aframe/blob/master/tests/components/gltf-model.test.js#L21
The gltf model loads but when setting the mesh object in this this line:
https://github.com/aframevr/aframe/blob/master/src/components/gltf-model.js#L48
The obj instanceof THREE.Object3D test in the line below fails throwing an error and making the test fail:
https://github.com/aframevr/aframe/blob/master/src/core/a-entity.js#L128
I can reproduce in console during the test execution but don’t know why it’s failing. I’m pretty puzzled because only happens in the context of the tests and cannot reproduce outside. Could be some of the polyfills or monkey patching we’re doing
@vincentfretin Any ideas? Thanks
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 50 (50 by maintainers)
Nice, so context for what was happening:
karma.conf.jsaddedsrcas one of the folder names to search in.three.mjsimportsthreeit resolves tonode_modules/three/build/three.module.jsas it shouldthree.mjsimports theGLTFLoaderit correctly resolves it tonode_modules/three/examples/jsm/loaders/GLTFLoader.js.GLTFLoaderimports fromthreeit resolved incorrectly tonode_modules/three/src/Three.jsnode_modules/three/examples/jsm/loaders/GLTFLoader.jstill it finds either asrc/ornode_modules/folder.src/folder innode_modules/three/it checks if it can find “three”, which it finds in the form ofnode_modules/three/src/Three.jsWhat strikes me as odd is that it accepts
Three.jsfor the identifierthreedespite the capitalization difference. My guess is that under Linux it rejects it, but under Mac OS somehow accepts it. Either way, we don’t want to search for anysrcfolder, but a specific one. Hence replacing it with an absolute path fixes it. (Relevant webpack docs: resolve.modules)That did the trick! Thanks so much for the patience and sticking with me. Super super appreciated!