I have some protractor tests and I would like to mock some calls to a third party service used by my Angular JS app.
I've read about ngMockE2E. My understanding is this requires I add angular-mocks.js to my page.
What are the best practices including angular-mocks.js in a page? Should I use some sort of pre-processor to remove it or is it somehow safe for use in a production environment?
Protractor allows you to add arbitrary mock modules via
browser.addMockModule()
(which would though still requireangular-mocks
module to be loaded). Sample usages:I would solve it on the application build level (with
grunt
orgulp
, for example). Installangular-mocks
package and include in the build only for the dev/test environment.