Scoped Shared Examples
The main purpose of this release was to add scoping to sharedExamplesFor. Previously that function defined shared examples globally, from this release it defines them in scope of suite where it was called.
Features
- shared-examples: adds support for scoping
describe('Array', () => {
subject(() => [1, 2, 3])
sharedExamplesFor('a collection', () => {
it('has 3 items', () => expect($subject).to.have.length(3))
})
includeExamplesFor('a collection')
})
describe('Set', () => {
subject(() => new Set([1, 2, 3]))
sharedExamplesFor('a collection', () => {
it('has 3 items', () => expect($subject.size).to.equal(3))
})
includeExamplesFor('a collection')
})