Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 1.3 KB

no-angular-mock.md

File metadata and controls

49 lines (31 loc) · 1.3 KB

no-angular-mock - require to use angular.mock methods directly

All methods defined in the angular.mock object are also available in the object window. So you can remove angular.mock from your code

Rule based on Angular 1.x

Examples

The following patterns are considered problems;

/*eslint angular/no-angular-mock: 2*/

// invalid
angular.mock.dump($scope); // error: You should use the "dump" method available in the window object.

// invalid
angular.mock.inject(function (someService) {
    // ...
}); // error: You should use the "inject" method available in the window object.

// invalid
angular.mock.module('myModule'); // error: You should use the "module" method available in the window object.

The following patterns are not considered problems;

/*eslint angular/no-angular-mock: 2*/

// valid
dump($scope);

// valid
inject(function (someService) {
    // ...
});

// valid
module('myModule');

Version

This rule was introduced in eslint-plugin-angular 0.2.0

Links