karma-jasmine-def

0.1.0 • Public • Published

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();
  });
});

Package Sidebar

Install

npm i karma-jasmine-def

Weekly Downloads

330

Version

0.1.0

License

MIT

Last publish

Collaborators

  • vlazar