ReferenceError: Lame is not defined
ReneLems opened this issue · comments
I import this library with ES6 like this
import lamejs from 'lamejs';
Im using webpack and babel to compile my ES6 code, this all works fine. But when I run my Mocha tests i run into the following error:
node_modules/lamejs/src/js/index.js:19
Lame = require('./Lame.js');
^
ReferenceError: Lame is not defined
Shouldn't the following classes be defined as a variable?
Lame = require('./Lame.js');
Presets = require('./Presets.js');
GainAnalysis = require('./GainAnalysis.js');
QuantizePVT = require('./QuantizePVT.js');
Quantize = require('./Quantize.js');
Takehiro = require('./Takehiro.js');
Reservoir = require('./Reservoir.js');
MPEGMode = require('./MPEGMode.js');
BitStream = require('./BitStream.js');
I'll make a PR for this, but please let me know if I'm missing something
Nevermind, I now see that i needed to mock this package. Also instantiating these as variables gives other errors. I'm going to close this issue. Sorry for the unnecessary issue
@ReneLems How did you fix the problem?
@ReneLems I wish you could just tell us how did you fix it
@MooseSaeed I mocked the Lame service, since the error only occurred for me while testing with Mocha. Didn't need to fix the issue this way. If the error occurs for you during testing as well, then you can also mock Lame, otherwise I can't help you.