bdd-lazy-var

Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.

MIT License

Downloads
61K
Stars
162
Committers
11
bdd-lazy-var - v2.6.1 Latest Release

Published by stalniy over 3 years ago

2.6.1 (2021-03-14)

bdd-lazy-var - v2.6.0

Published by stalniy almost 4 years ago

2.6.0 (2020-12-10)

Features

  • sharedBehavior: adds possibility to pass function in (3e2196f)
bdd-lazy-var - Shortcuts

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.

Features

  • interface: adds support for its
  • interface: adds support for it without a message
describe('Array', () => {
  subject(() => [1, 2, 3])

  its('length', () => is.expected.to.equal(3))
  it(() => is.expected.to.be.an('array'))
})
bdd-lazy-var - Scoped Shared Examples

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.

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')
})
bdd-lazy-var - Shared Examples

Published by stalniy over 6 years ago

The main purpose of this release was bug fixes after massive refactoring and new shared behavior feature

Features

  • ui: adds shared behavior

Bug fixes

  • variable: fixes access to parent variable inside child override definition
  • metadata: fixes metadata inheritance when for contexts without lazy vars
  • get: returns undefined when variable does not exist @iain-b

Performance

  • variable: decreases amount of afterEach 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')
})
bdd-lazy-var - 2.1.0 Jest support

Published by stalniy almost 7 years ago

The main purpose of this release was support for Jest framework

Features

  • ui: adds support for jest
  • interface: exports 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')
  })
})
bdd-lazy-var - 2.0.0 Universal Lazy Vars

Published by stalniy almost 7 years ago

2.0.0 (2018-01-09)

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

Features

  • interface: adds support for jasmine testing framework

Documentation

  • README: updates documentation to clearly reflect the purpose of the project

Breaking Changes

  • interface: 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