Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.
MIT License
Published by stalniy over 6 years ago
The main purpose of this release was to add shortcuts its
and it
without a message. This allows to write subject specific tests easier.
its
it
without a messagedescribe('Array', () => {
subject(() => [1, 2, 3])
its('length', () => is.expected.to.equal(3))
it(() => is.expected.to.be.an('array'))
})
Published by stalniy over 6 years ago
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.
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')
})
Published by stalniy over 6 years ago
The main purpose of this release was bug fixes after massive refactoring and new shared behavior
feature
undefined
when variable does not exist @iain-bafterEach
callbacks. Now there is a single afterEach
on root level instead of a single afterEach
for each describe/context
sharedExamplesFor('a collection', () => {
it('has three items', () => {
expect($subject.size).to.equal(3)
})
describe('#has', () => {
it('returns true with an an item that is in the collection', () => {
expect($subject.has(7)).to.be.true
})
it('returns false with an an item that is not in the collection', () => {
expect($subject.has(9)).to.be.false
})
})
})
describe('Set', () => {
subject(() => new Set([1, 2, 7]))
itBehavesLike('a collection')
})
describe('Map', () => {
subject(() => new Map([[2, 1], [7, 5], [3, 4]]))
itBehavesLike('a collection')
})
Published by stalniy almost 7 years ago
The main purpose of this release was support for Jest framework
get
and def
functions from every dialect file. So, now it's possible to write tests as this:const { def, subject } = require('bdd-lazy-var/global')
describe('Suite', () => {
def('suite', () => new Suite())
it('has parent', () => {
expect($suite).to.have.property('parent')
})
})
Published by stalniy almost 7 years ago
The main purpose of this release was a goal to refactor package, so that it's possible to add support for other testing frameworks like jasmine
rspec
is no longer available. Currently all interfaces work according to rspec flow execution. If you used bdd-lazy-var/rspec
just replace it with bdd-lazy-var/global