added linting and testing boilerplate with sanity check

This commit is contained in:
Andrew E. Rhyne 2016-12-14 00:16:55 -08:00
parent 803fb05785
commit f77ca5d56c
8 changed files with 55 additions and 11 deletions

4
.babelrc Normal file
View File

@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"sourceMaps": true
}

15
.eslintrc Normal file
View File

@ -0,0 +1,15 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 0
},
"extends": "eslint:recommended"
}

View File

@ -1,3 +0,0 @@
{
"laxbreak": true
}

View File

@ -1,4 +1,3 @@
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
@ -6,12 +5,18 @@ THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# Path
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
# applications
NODE ?= $(shell which node)
YARN ?= $(shell which yarn)
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
BROWSERIFY ?= $(NODE) $(BIN)/browserify
.FORCE:
all: dist/debug.js
install: node_modules
@ -33,5 +38,11 @@ distclean: clean
node_modules: package.json
@NODE_ENV= $(PKG) install
@touch node_modules
lint: .FORCE
eslint debug.js
test: .FORCE
mocha
.PHONY: all install clean distclean

View File

@ -28,12 +28,6 @@ exports.skips = [];
exports.formatters = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Previous log timestamp.
*/

View File

@ -21,8 +21,18 @@
"ms": "0.7.2"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-eslint": "^7.1.1",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.18.0",
"babel-register": "^6.18.0",
"babel-runtime": "^6.20.0",
"browserify": "9.0.3",
"mocha": "*"
"chai": "^3.5.0",
"eslint": "^3.12.1",
"eslint-plugin-babel": "^4.0.0",
"mocha": "^3.2.0",
"sinon": "^1.17.6"
},
"main": "./index.js",
"browser": "./browser.js",

12
test/debug_spec.js Normal file
View File

@ -0,0 +1,12 @@
import { expect } from 'chai';
import debug from '../index';
describe('debug', () => {
describe('sanity check', () => {
it('passes', () => {
const log = debug('test');
log('hello world');
});
});
})

1
test/mocha.opts Normal file
View File

@ -0,0 +1 @@
--compilers js:babel-register