From 7a67e98eda5ce441bdddc04c2dceea915e488952 Mon Sep 17 00:00:00 2001 From: Mike Arpaia Date: Tue, 6 Sep 2016 17:00:34 -0400 Subject: [PATCH] Making JS tests windows friendly (#123) --- .eslintrc.js | 39 ++++++++++++++++++++------------------- Makefile | 17 ++++++++++++++--- package.json | 5 ++--- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5193d635e7..a2cb42d830 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,32 +1,33 @@ var path = require('path'); module.exports = { - extends: "airbnb", - parser: "babel-eslint", + extends: 'airbnb', + parser: 'babel-eslint', plugins: [ - "react" + 'react' ], env: { - "node": true, - "mocha": true + 'node': true, + 'mocha': true }, globals: { - "expect": false, - "describe": false + 'expect': false, + 'describe': false }, rules: { - "consistent-return": 1, - "arrow-body-style": 0, - "max-len": 0, - "no-use-before-define": [2, "nofunc"], - "no-unused-expressions": 0, - "no-console": 0, - "space-before-function-paren": 0, - "react/prefer-stateless-function": 0, - "react/no-multi-comp": 0, - "no-param-reassign": 0, - "new-cap": 0, - 'import/no-unresolved': 'error' + 'consistent-return': 1, + 'arrow-body-style': 0, + 'max-len': 0, + 'no-use-before-define': [2, 'nofunc'], + 'no-unused-expressions': 0, + 'no-console': 0, + 'space-before-function-paren': 0, + 'react/prefer-stateless-function': 0, + 'react/no-multi-comp': 0, + 'no-param-reassign': 0, + 'new-cap': 0, + 'import/no-unresolved': 'error', + 'linebreak-style': 0 }, settings: { 'import/resolver': { diff --git a/Makefile b/Makefile index 0ec33e231e..df28cac6d2 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,21 @@ else go build -o build/kolide endif -test: +lint-js: + $(shell npm bin)/eslint . --ext .js,.jsx + +lint-go: go vet $(shell glide nv) + +lint: lint-go lint-js + +test-go: go test -v -cover $(shell glide nv) - npm run test + +test-js: + $(shell npm bin)/_mocha --compilers js:babel-core/register --recursive 'frontend/**/*.tests.js*' --require testSetup.js + +test: lint test-go test-js generate: .prefix go-bindata -pkg=server -o=server/bindata.go frontend/templates/ build/ @@ -30,7 +41,7 @@ generate-dev: .prefix $(shell npm bin)/webpack --progress --colors --bail --watch deps: - npm install + npm install --dev go get -u github.com/Masterminds/glide go get -u github.com/jteeuwen/go-bindata/... glide install diff --git a/package.json b/package.json index 023dc575f9..3a6ec216fc 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,8 @@ "author": "Kolide, Inc.", "private": "true", "scripts": { - "lint": "eslint . --ext .js,.jsx", - "mocha": "node_modules/mocha/bin/_mocha --compilers js:babel-core/register --recursive 'frontend/**/*.tests.js*' --require testSetup.js", - "test": "npm run lint && npm run mocha" + "lint": "make lint-js", + "test": "make test-js" }, "dependencies": { "autoprefixer": "6.3.7",