Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blueberryapps/generate-unit-test
Generates basic unit test for mocha, sinon and chai
https://github.com/blueberryapps/generate-unit-test
Last synced: 27 days ago
JSON representation
Generates basic unit test for mocha, sinon and chai
- Host: GitHub
- URL: https://github.com/blueberryapps/generate-unit-test
- Owner: blueberryapps
- License: mit
- Created: 2015-11-06T10:42:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-06T16:07:49.000Z (about 9 years ago)
- Last Synced: 2024-09-29T06:22:35.245Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 0 Bytes
- Stars: 5
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# generate-unit-test
[![Circle CI](https://circleci.com/gh/blueberryapps/generate-unit-test/tree/master.svg?style=svg&circle-token=885eda2778038bda1423cacba2d371c73851515a)](https://circleci.com/gh/blueberryapps/generate-unit-test/tree/master)Pass file to generate-unit-test and it will generate basic unit test boilerplate:
checkout: from [Headline.react.js](example/Headline.react.js) it creates test directory and generate [\_\_test\_\_/Headline.js](example/__test__/Headline.js)## Install
```sh
$ npm install --save generate-unit-test
```## Gulp Usage
```js
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
```js
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](https://github.com/ondrejbartas)
Boilerplated from (https://github.com/este/module)