cosmos-mocha

    2.0.4 • Public • Published

    cosmos-mocha

    Make dynamic tests that checks that corresponding components at least renders on your fixtures.

    Installation

    npm i cosmos-mocha --save-dev
    

    Add CosmosTest.js to your mocha tests

    import {generateTests} from 'cosmos-mocha';
    
    generateTests(require('react/addons'), __dirname, <fixtures relativePath>, <components relativePath>);
    

    you can skip generated test adding leading 'x' to fixture filename.

    JSdom node test and karma-webpack tests

    cosmos-mocha support jsdom node tests (jsdom requires io.js and will not work with Node.js 0.12 or below) or karma-webpack browser tests (see examples) jsdom runs in node (no browser) so they are faster but they ignore all webpack specific requires like require('style.less') if have these and want to use cosmos-mocha with css-modules for example you need to run it as karma-webpack example do.

    Example

    Also try to run

    npm run test
    

    in example, and break some component or delete required prop from fixture.

    Keywords

    none

    Install

    npm i cosmos-mocha

    DownloadsWeekly Downloads

    3

    Version

    2.0.4

    License

    ISC

    Last publish

    Collaborators

    • lapanoid