I want to test some classes (one per module) with dependencies (no ciruclar) in a folder structure like this :
/src
/chessmen
Kings.js (extends ../core/Chessman)
Pawn.js (extends ../core/Chessman)
...
/core
Board.js (imports Refs)
Chessman.js (imports Ray)
Ray.js
Refs.js
Sides.js (imports WindRoses.js)
WindRoses
/engine
RayCaster.js
/test
/chessmen
...
/core
...
/engine
RayCaster.js (import src/core/ Refs, sides, King, Queen, board)
The trouble comes when testing with karma + Jasmine + babel preprocessor
If a first test case imports and use, saying, Sides.js or King.js, seems to "eat" or consume the data, in a way that it s impossible to use the imported module in another test case
for example, test/engine/RayCaster imports a Queen module, but it logs with a object {} (empty) in place of function Queen() { ... }
QUESTIONS
What's happening ?
Is it possible to reset imports (or cancel them) between test cases
Since karma imports files alphabetically, it it possible to have a kind of test/index.js which does all imports and call tests in the dependency module order ?
Aucun commentaire:
Enregistrer un commentaire