Just a better way to test AngularJS apps.
0 people use it
Submitted by: 924465?v=2 boneskull

angular-debaser Build Status Coverage Status

Just a better way to test AngularJS apps.

The Idea

AngularJS and its dependency injection make it very easy to isolate your code under test.
Unfortunately, coding up stubs for those services can get tedious (many services injected, many modules depending upon modules), and you could end up with a fixture that dwarfs your assertions.

angular-debaser attempts to reduce the size of your fixtures and make them natural to write.


Given the following beastly fixture and test:

We'll use angular-debaser instead. It becomes this:

(If you're counting, that's about half as many lines.)

Interested? Trying to test something that injects 46 services?? You may want to read the tutorial & go down the rabbit hole.


If Sinon.JS is present, see this API for working with functions.

See the API documentation.


Optionally, save it to your bower.json: you probably don't want to use --save; use --save-dev.

Dependencies & Recommended Packages

Current dependencies:

Required, but not marked as dependencies:


  • sinon-ng for working with $q; bower install sinon-ng

Depending on your test runner setup, you may want to install these either via bower or npm:

Also, if you are testing directives, I've found that jQuery is always handy to have around.


Issues here.


Copyright © 2014 Decipher, Inc. Licensed MIT.


Christopher Hiller

comments powered by Disqus
This page was last updated about 4 years ago.