Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 927 Bytes

no-global-setup.md

File metadata and controls

25 lines (16 loc) · 927 Bytes

Disallow using setup and teardown methods outside a suite (no-global-setup).

Make sure that all uses of the global beforeEach, afterEach, beforeAll, and afterAll methods are within a suite.

The only appropriate use of these methods in a global context is within jasmine helpers where the intent of the global definition is explicit (e.g. setting up globally applied matchers). See example: /jasmine/jasmine/lib/jasmine-core/example/node_example/spec/helpers/jasmine_examples/SpecHelper.js

Rule details

The following are considered warnings:

beforeEach(function() { /* ... */ })

afterEach(function() { /* ... */ })

The following patterns are not warnings:

describe(function() {
  beforeEach(function() { /* ... */ })
})