Skip to content

Commit

Permalink
added linting and testing boilerplate with sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigredgeek committed Dec 14, 2016
1 parent 803fb05 commit f77ca5d
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"sourceMaps": true
}
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 0
},
"extends": "eslint:recommended"
}
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@

# 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)

# 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
Expand All @@ -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
6 changes: 0 additions & 6 deletions debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ exports.skips = [];

exports.formatters = {};

/**
* Previously assigned color.
*/

var prevColor = 0;

/**
* Previous log timestamp.
*/
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions test/debug_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { expect } from 'chai';

This comment has been minimized.

Copy link
@TooTallNate

TooTallNate Dec 14, 2016

Contributor

We could possibly try out ava if we're getting all ES6-ey


import debug from '../index';

describe('debug', () => {
describe('sanity check', () => {
it('passes', () => {
const log = debug('test');
log('hello world');
});
});
})
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--compilers js:babel-register

0 comments on commit f77ca5d

Please sign in to comment.