Open jannon opened 8 years ago
I have the same issue on windows 10. have you found any solution?
@jannon I have the same issue on my mac. Did you find a solution on this problem?
Same issue on Ubuntu 16.04, meteor 1.4.3.2, any solution ?
I solved my issue by executing the test only on client. If the test running in web-browser there is no problem. angular-mocks is only imported on client side.
Here a example of unit test for a service :
/* eslint-env mocha */
import { Meteor } from 'meteor/meteor';
import 'meteor/practicalmeteor:mocha';
if (Meteor.isClient) {
import { assert } from 'meteor/practicalmeteor:chai';
import { sinon } from 'meteor/practicalmeteor:sinon';
import 'angular-mocks';
import { myModule } from '/imports/ui/modules/myModule';
describe('myService', function() {
var service;
beforeEach(function() {
window.module(myModule);
inject(function(_myService_){
service = _myService_;
});
});
it('should contain a test array', function() {
assert.lengthOf(service.testArray,4);
});
});
}
Execute the command meteor test --driver-package practicalmeteor:mocha
for testing and connect the web-browser to localhost to get the results.
On Mac OS X I'm running into the following error when trying to do the tutorial testing steps (11.6 & 11.7) that involve angular mocks
If I comment out the angular-mocks import, I get the following error:
And, of course, commenting out the todosList import as well at least lets the testrunner proceed, but the tests error since the component it's testing isn't available.
Don't know enough about meteor/angular/mocha yet to have any idea why this is failing