mercredi 4 mars 2015

How to inject mock services into Angular without running unit or e2e tests

I want to inject a mock data provider into my Angular app so that I can see how some plots I'm rendering behave with data that's more dense than what's available in our backend. I want to actually interact with the app, not run a unit test or end-to-end test.


The problem, from the Angular documentation:



angular.mock.inject
...
NOTE: This function is declared ONLY WHEN running tests with jasmine or mocha


Does anyone know how a standard way to work around this to inject mocks without running jasmine or mocha? Or will I just have to add some custom code to switch between the real and mock services in my factories?


Aucun commentaire:

Enregistrer un commentaire