0.1.0 • Published 8 years ago

karma-jasmine-def v0.1.0

Weekly downloads
71
License
MIT
Repository
github
Last release
8 years ago

karma-jasmine-def

npm version Build Status Code Climate Test Coverage devDependencies Status js-standard-style

Adds def and subject functions - a better way to setup Jasmine test subjects.

Usage

Install

npm install karma-jasmine karma-jasmine-def --save-dev

Configure Karma

module.exports = function(config) {
  config.set({
    frameworks: ['jasmine', 'jasmine-def']
  });
};

Write specs

describe('a cleaner spec with lazy test subjects', function () {
  subject(function () {
    return new SomeObject(this.options);
  });

  def('options', function () {
    return { foo: 'foo' };
  });

  it('works', function () {
    expect(this.options).toBeDefined();
    expect(this.subject).toBeDefined();
  });
});