0.6.0 • Published 8 years ago

madewithlove-karma-config v0.6.0

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

Madewithlove Karma configuration

Usage

karma.conf.js

module.exports = function(config) {
    // Returns the Karma config object
    // Optionally set path to tests, defaults to `tests`
    config = require('madewithlove-karma-config')(
        config,
        'tests/karma'
    );

    // Customize additional options
    config.browsers = ['Firefox'];
};

tests/index.js

const testsContext = require.context('.', true, /Test.js$/);
testsContext.keys().forEach((path) => {
    let suite = path.replace(/\.\/(.+)Test.js/, '$1');

    describe(suite, () => testsContext(path));
});

tests/Reducer/SomeReducerTest.js

it('can do something', () => {
    // ...
});

Test utilities

The package also comes with some test utilities for common needs:

import expect from 'madewithlove-karma-config/expect';

expect(new Immutable.Map({foo: 'bar'})).toEqualJs({
    foo: 'bar',
});

expect(someSaga()).toEqualSaga([
    {
        action: put(someAction()),
        response: 'foobar',
    },
    {
        action: select(someSelector('foobar')),
        response: 'baz',
    }
]);