Closed akoshelev closed 10 years ago
One of solutions - don't use karma-commonjs preprocessor for your test files. Will it work for your case?
@akoshelev the angular-mocks.js file is not written as a CommonJS module, so I'm not sure why you are trying to pass it through CommonJS pre-processor. Is there is a particular reason for doing so?
@lastday is right here - this file shouldn't go through the CommonJS pre-processor as it doesn't require
any CommonJS modules and doesn't export any CommonJS modules.
@akoshelev you could also try to call 'angular.mock.module()' instead of 'module()' as they are the same.
@lastday Yes, I think this is the only one possible solution, thanks.
Hi,
I tried to use this module with application that built around AngularJS framework and faced a problem. I write unit tests using Mocha and my specifications look like this:
After loading karma-commonjs plugin, karma fails to run tests with the following error:
I understand why it happens: karma-commonjs modifies file contents as follows:
This modification breaks reference to angular.module - module variable now points to CommonJS module, not to AngularJS mock module. So it seems to me that there is a name conflicting issue. Can we address this issue or there is only one possible solution not to use module, but to use angular.module instead?