npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

generate-unit-test

0.1.2 • Public • Published

generate-unit-test

Circle CI

Pass file to generate-unit-test and it will generate basic unit test boilerplate: checkout: from Headline.react.js it creates test directory and generate __test__/Headline.js

Install

$ npm install --save generate-unit-test

Gulp Usage

import generateUnitTest from 'generate-unit-test';
 
gulp.task('generate-test', (done) => {
  if (yargs.argv.file)
    // test/mochaTestHelper - is relative path to project which point to mocha test helper
    generateUnitTest(`${__dirname}/${yargs.argv.file}`, __dirname, 'test/mochaTestHelper')
  else
    console.error('Please provide component file by --file some/file')
})
 
=> gulp generate-test --file src/client/components/Xyz.js

CLI Usage

generate-unit-test src/client/components/Xyz.js src/client/components/Zaz.js

mochaTestHelper

import chai, {assert, expect} from 'chai';
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
 
chai.should();
chai.use(sinonChai);
 
export {
  assert,
  chai,
  expect,
  React,
  sinon,
  sinonChai,
  TestUtils
};

License

MIT © Ondrej Bartas

Boilerplated from (https://github.com/este/module)

install

npm i generate-unit-test

Downloadsweekly downloads

4

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability