angularjs-webpack: Error running test
I created a project and built off of this starter, but when I try to run my first test:
import app from './app.module'; // set up the app module.
import './globalservices/someService'; // register the service onto the 'app' module.
describe('someService', () => {
let service;
beforeEach(() => {
angular.mock.module('app');
angular.mock.inject(_someService_ => {
service = _someService_;
});
});
it('service should exist.', () => {
console.log(service);
return;
});
});
I get an error like
❯ npm run test
> angular-webpack-workflow@1.0.0 test /Users/trusktr/src/refuel4+sme-onboarding
> karma start
05 05 2016 22:22:53.200:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
05 05 2016 22:22:53.245:INFO [launcher]: Starting browser PhantomJS
05 05 2016 22:22:58.348:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#LzaJexxVlI1wyYJ5AAAA with id 1411457
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
ReferenceError: Can't find variable: Map
at undefined:14
Perhaps one of the files I imported eventually imports something that use new Map
, but, as you can see the error isn’t helpful at all (no idea where this happens). Any thoughts?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (5 by maintainers)
After importing babel-polyfill, I still have the same problem. The callback of angular.mock.inject did not execute. Here is my test file.
The error message.