Improves AngularJS testing
JavaScript
Latest commit ecec476 Jul 15, 2016 @evangalen The Jasmine tests are now also running against AngularJS 1.5; however…
… still using PhantomJS 1.9.x (instead of 2.1.x) since somehow using PhantomJS 2.1.x gives some unexpected Jasmine test failures.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.jshintrc
.travis.yml
Gruntfile.js
LICENSE
README.md
bower.json
karma-angular-1.2.conf.js
karma-angular-1.3.conf.js
karma-angular-1.4.conf.js
karma-angular-1.5.conf.js
karma-shared.conf.js
package.json

README.md

ngImprovedTesting  Travis build status Coverage Status Bower version

Improves AngularJS testing

For more information about:

  • the mock testing support read this blog post.
  • using $q.tick() to improve testing promises read this blog post.

Changes

0.3.0

  • The ModuleBuilder now includes the whole original module; Since the whole module is now includes there is no need for any of the "...AsIs" methods (i.e. "serviceAsIs") and therefor all off them hav been removed.
  • Introduced the a new static ModuleBuilder.forModules method with a variable argument and the same possible argument types as angular.mock.module.
  • Deprecated the existing static ModuleBuilder.forModule method in favor of ModuleBuilder.forModules.
  • The "angular.mock.inject" functionality has been modified to disallow injecting the original service instead of its mocked counterpart. This to prevent mistakingly injecting the original (non-mocked) service in your tests.
  • Fixed #16 (Some of the "...MocksFor" and "...MocksExcept" don't support variable arguments bug)
  • Fixed #15 ($httpBackend doesn't work with mocks enabled bug)
  • Fixed #14 (Using "directiveWithMocks..." should only be allowed when directive is registered once or only once overriden a built-in one enhancement)
  • Fixed #13 (Using "...WithMocks..." should not be allowed on built-in components)
  • Fixed #8 (MockBuilder doesn't correctly handle components declared in inherited modules)
  • Fixed #11 (Using ModuleBuilder.forModule('app') on a module which uses $location breaks the tests)
  • Fixed #12 (Prevent duplicate directive when mocking the injected services of a directive enhancement)

0.2.3

  • Fixed #9 (ModuleBuilder doesn't support angular modules declared in .js file loading after .js file of Jasmine spec)

0.2.2

  • Fixed #5 (Chained promises are not included when using $q.tick())

0.2.1

  • Various changes to actually get $q.tick() working including enabling / disabling it

0.2.0

  • AngularJS 1.0.x is no longer supported
  • no longer uses any internal AngularJS API (like 0.1.x did)
  • mocks can now also be manually created using the (global) mockInstance(...) method
  • when using a ModuleBuilder or using the "ngImprovedTesting" module the $q service is extended with "tick()" method

0.1.3

  • Fixes #3 (Internally created $injector doesn't include "ngMock")

0.1.2

  • Support for AngularJS 1.0 (as well as the latest stable 1.3)
  • Support for "provider" registered services
  • Support for testing animations with mocked dependencies (when using AngularJS 1.2+)
  • Fixes #2 (looks like cannot inject $rootScopeMock) Object with only inherited method (and no own methods) will now be mocked. For instance a $rootScope with only inherited methods from its prototype will now correct result in a $rootScopeMock dependency with its being requested for mocking.

0.1.1

  • Fixes #1 (Error on circular module dependencies.)
  • Support for testing directives with mocked dependencies

0.1.0 Initial release

Bower

You can easily install and add it to an existing project using the following command:

bower install ng-improved-testing --save-dev