Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ReferenceError: Lame is not defined #58

Closed
ReneLems opened this issue Mar 6, 2019 · 5 comments · Fixed by #59
Closed

ReferenceError: Lame is not defined #58

ReneLems opened this issue Mar 6, 2019 · 5 comments · Fixed by #59

Comments

@ReneLems
Copy link
Contributor

ReneLems commented Mar 6, 2019

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

@ReneLems
Copy link
Contributor Author

ReneLems commented Mar 6, 2019

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 ReneLems closed this as completed Mar 6, 2019
@YannicEl
Copy link

@ReneLems How did you fix the problem?

@wasimafsar
Copy link

@ReneLems How did you fix the problem?

@MooseSaeed
Copy link

@ReneLems I wish you could just tell us how did you fix it

@rlems
Copy link

rlems commented Mar 21, 2022

@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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants