stalniy / bdd-lazy-var

Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.
MIT License
162 stars 14 forks source link

Allow to define multiple variables and extract them respectively #21

Closed stalniy closed 7 years ago

stalniy commented 7 years ago

Example:

describe('Suite', function() {
  const { fullName, firstName, lastName } = def.vars({
      firstName: 'BDD',

      lastName: 'Lazy variables',

      fullName() {
        return `${firstName} ${lastName}`;
      }
  });

  it('computes variables', function() {
    expect(fullName).to.equal('BDD Lazy variables');
  });
})

This way library won't pollute global scope with $varName getters.

This is a breaking change as I'm going to increase supported node version to node 4.x (or 6.x) and remove ui for global variables and getters on get function.

stalniy commented 7 years ago

tested, and looks like invalid. Getters are called at the time of destructuring...