I am trying to write a unit test for a Renderer subclass from lance-gg
// test/client.js
const lance = require('lance-gg');
console.log(lance);
{
GameEngine: [Function: GameEngine],
GameWorld: [Function: GameWorld],
P2PhysicsEngine: [Function: P2PhysicsEngine],
SimplePhysicsEngine: [Function: SimplePhysicsEngine],
BaseTypes: [Function: BaseTypes] {
TYPES: {
FLOAT32: 'FLOAT32',
INT32: 'INT32',
INT16: 'INT16',
INT8: 'INT8',
UINT8: 'UINT8',
STRING: 'STRING',
CLASSINSTANCE: 'CLASSINSTANCE',
LIST: 'LIST'
}
},
TwoVector: [Function: TwoVector],
DynamicObject: [Function: DynamicObject],
PhysicalObject2D: [Function: PhysicalObject2D],
PhysicalObject3D: [Function: PhysicalObject3D],
ServerEngine: [Function: ServerEngine],
Lib: { Trace: [Function: Trace] }
}
./node_modules/.bin/mocha --require @babel/register ./test/client.js
However, lance.Renderer
resolves to undefined, which leads me to suspect that somehow lance is building from the server exports rather than the client exports defined here: https://github.com/lance-gg/lance/blob/911b60bdb5b887aa281e7c968506028797616132/rollup.config.js
Here is an example of an existing test that seems to compile the client-side code into the test properly: https://github.com/lance-gg/lance/blob/master/test/EndToEnd/multiplayer.js
My question is, how does require('lance-gg') know whether to import the client-side or server-side
How do I get the test to compile from the client-side exports instead?