mirror of
https://github.com/debug-js/debug.git
synced 2026-01-18 16:12:38 +00:00
added linting and testing boilerplate with sanity check
This commit is contained in:
parent
803fb05785
commit
f77ca5d56c
15
.eslintrc
Normal file
15
.eslintrc
Normal 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"
|
||||
}
|
||||
13
Makefile
13
Makefile
@ -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
|
||||
|
||||
6
debug.js
6
debug.js
@ -28,12 +28,6 @@ exports.skips = [];
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previously assigned color.
|
||||
*/
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
12
package.json
12
package.json
@ -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
12
test/debug_spec.js
Normal 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
1
test/mocha.opts
Normal file
@ -0,0 +1 @@
|
||||
--compilers js:babel-register
|
||||
Loading…
x
Reference in New Issue
Block a user