Add tests

This commit is contained in:
Jake Howard 2016-03-25 12:28:28 +00:00
parent 501cb12d17
commit c6c99a0ca1
7 changed files with 46 additions and 5 deletions

View file

@ -1,5 +1,11 @@
{
"extends": "./node_modules/eslint-config/.eslintrc",
"parser": "babel-eslint",
"globals": { }
"globals": {
"before": true,
"beforeEach": true,
"describe": true,
"it": true,
"expect": true
}
}

9
.istanbul.yml Normal file
View file

@ -0,0 +1,9 @@
instrumentation:
root: .
extensions:
- .js
default-excludes: true
include-all-sources: true
excludes: ['tests/**']
reporting:
print: both

View file

@ -4,9 +4,11 @@
"description": "",
"main": "lib/index.js",
"scripts": {
"build": "browserify ./lib/cli.js -o ./test/out.js",
"test": "browserify ./test/test.js -t ./lib/index.js -o ./test/out.js",
"lint": "eslint 'lib/'"
"build-cli": "browserify ./lib/cli.js -o ./bin/cli.js",
"test": "./scripts/runtests",
"lint": "eslint 'lib/'",
"coverage": "istanbul cover node_modules/.bin/_mocha -- --require scripts/test-helper.js --bail --recursive 'tests/**/*.js'",
"mocha": "mocha --require scripts/test-helper.js --bail 'tests/**/*.js'"
},
"bin": "./bin/cli.js",
"author": "TheOrangeOne <git@theorangeone.net>",

13
scripts/runtests Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
echo ">> Linting..."
eslint 'lib/'
echo ">> Testing Build..."
browserify ./test/test.js -t ./lib/index.js -o ./test/out.js
echo ">> Testing Project..."
npm run coverage

5
scripts/test-helper.js Normal file
View file

@ -0,0 +1,5 @@
const chai = require('chai');
const sinonChai = require('sinon-chai');
chai.expect();
chai.use(sinonChai);

View file

@ -1 +0,0 @@
console.log('foobar');

7
tests/basic.test.js Normal file
View file

@ -0,0 +1,7 @@
const expect = require('chai').expect;
describe('Basic Mocha Setup', function () {
it('adds two and two and gets four', function () {
expect(2 + 2).to.equal(4);
});
});