Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Latest commit

 

History

History
46 lines (34 loc) · 971 Bytes

missing-expect.md

File metadata and controls

46 lines (34 loc) · 971 Bytes

Enforce expectation (missing-expect)

A test which doesn't make any expectations doesn't really test anything.

Rule details

This rule triggers a warning if no expectations are made. This rule is disabled by default.

An array of expect function names may be passed to the configuration of this rule. By default only expect is used.

Default configuration

The following patterns are considered warnings:

it('should do something', function() {});

The following patterns are not warnings:

it('should do something', function() {
  expect(something).toBeDone();
});

AngularJS $httpBackend example

configuration

rules:
  missing-expect:
    - 2
    - expect()
    - $httpBackend.expect()
    - $httpBackend.expectDELETE()
    - $httpBackend.expectGET()
    - $httpBackend.expectJSONP()
    - $httpBackend.expectHEAD()
    - $httpBackend.expectPATCH()
    - $httpBackend.expectPOST()
    - $httpBackend.expectPUT()