Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 1.17 KB

new-line-before-expect.md

File metadata and controls

81 lines (62 loc) · 1.17 KB

Enforce new line before expect inside a suite

This rule enforces that there is an empty line before expect. If expect is the first statement inside a test then rule is not enforced.

Rule details

This rule triggers a warning (is set to 1 by default) whenever there is no new line or another except before expect.

The following pattern is considered a warning:

describe("", function() {
  it("", function() {
    var a = 1;
    expect(a).toBe(1);
  });
});

The following patterns are not warnings:

describe("", function() {
  it("", function() {
    expect(1).toBe(1);
  });
});
describe("", function() {
  it("", function() {

    expect(1).toBe(1);
  });
});
describe("", function() {
  it("", function() {
    var a = 1;

    expect(a).toBe(1);
  });
});
describe("", function() {
  it("", async function() {
    var a = 1;

    await expect(a).toBe(1);
  });
});
describe("", function() {
  it("", function() {
    var a = 1;

    return expect(a).toBe(1);
  });
});
describe("", function() {
  it("", function() {
    var a = 1;

    expect(a).toBe(1);
    expect(a).not.toBe(0);
  });
});