Skip to content

sweepbright/jest-extended

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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',
    }
]);

About

Karma configuration for madewithlove projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%