Skip to content

Commit f77ca5d

Browse files
committed
added linting and testing boilerplate with sanity check
1 parent 803fb05 commit f77ca5d

8 files changed

Lines changed: 55 additions & 11 deletions

File tree

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015"],
3+
"sourceMaps": true
4+
}

.eslintrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 6,
4+
"sourceType": "module"
5+
},
6+
"parser": "babel-eslint",
7+
"env": {
8+
"browser": true,
9+
"node": true
10+
},
11+
"rules": {
12+
"no-console": 0
13+
},
14+
"extends": "eslint:recommended"
15+
}

.jshintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
21
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
32
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
43
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
54

65
# BIN directory
76
BIN := $(THIS_DIR)/node_modules/.bin
87

8+
# Path
9+
PATH := node_modules/.bin:$(PATH)
10+
SHELL := /bin/bash
11+
912
# applications
1013
NODE ?= $(shell which node)
1114
YARN ?= $(shell which yarn)
1215
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
1316
BROWSERIFY ?= $(NODE) $(BIN)/browserify
1417

18+
.FORCE:
19+
1520
all: dist/debug.js
1621

1722
install: node_modules
@@ -33,5 +38,11 @@ distclean: clean
3338
node_modules: package.json
3439
@NODE_ENV= $(PKG) install
3540
@touch node_modules
41+
42+
lint: .FORCE
43+
eslint debug.js
44+
45+
test: .FORCE
46+
mocha
3647

3748
.PHONY: all install clean distclean

debug.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ exports.skips = [];
2828

2929
exports.formatters = {};
3030

31-
/**
32-
* Previously assigned color.
33-
*/
34-
35-
var prevColor = 0;
36-
3731
/**
3832
* Previous log timestamp.
3933
*/

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,18 @@
2121
"ms": "0.7.2"
2222
},
2323
"devDependencies": {
24+
"babel": "^6.5.2",
25+
"babel-eslint": "^7.1.1",
26+
"babel-polyfill": "^6.20.0",
27+
"babel-preset-es2015": "^6.18.0",
28+
"babel-register": "^6.18.0",
29+
"babel-runtime": "^6.20.0",
2430
"browserify": "9.0.3",
25-
"mocha": "*"
31+
"chai": "^3.5.0",
32+
"eslint": "^3.12.1",
33+
"eslint-plugin-babel": "^4.0.0",
34+
"mocha": "^3.2.0",
35+
"sinon": "^1.17.6"
2636
},
2737
"main": "./index.js",
2838
"browser": "./browser.js",

test/debug_spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { expect } from 'chai';
2+
3+
import debug from '../index';
4+
5+
describe('debug', () => {
6+
describe('sanity check', () => {
7+
it('passes', () => {
8+
const log = debug('test');
9+
log('hello world');
10+
});
11+
});
12+
})

test/mocha.opts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--compilers js:babel-register

0 commit comments

Comments
 (0)