Skip to content

Commit

Permalink
Use jest for eslint (#98)
Browse files Browse the repository at this point in the history
Closes #94

Tap into jest runners to run eslint too so you can do everything in a single
command. Also added is-ci-cli so you can just do "npm test" regardless of what
environment you're in.
  • Loading branch information
arb committed Jan 19, 2019
1 parent b75cac3 commit c74849c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -3,6 +3,7 @@ language: node_js
node_js:
- "8"
- "10"
- "11"
- "node"

env:
Expand Down
31 changes: 19 additions & 12 deletions jest.config.js
@@ -1,15 +1,22 @@
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['lib/index.js'],
coverageDirectory: './coverage',
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
projects: [{
displayName: 'test',
collectCoverage: true,
collectCoverageFrom: ['lib/index.js'],
coverageDirectory: './coverage',
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
},
testEnvironment: 'node',
verbose: true,
testEnvironment: 'node',
verbose: true,
}, {
runner: 'jest-runner-eslint',
displayName: 'linter',
}],
watchPlugins: ['jest-runner-eslint/watch-fix'],
};
15 changes: 9 additions & 6 deletions package.json
Expand Up @@ -5,8 +5,9 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"lint": "eslint lib test --fix",
"test": "npm run lint && jest --ci",
"test": "is-ci 'test:ci' 'test:local'",
"test:local": "jest --watch",
"test:ci": "jest --ci",
"benchmark": "node benchmarks/index"
},
"repository": {
Expand Down Expand Up @@ -35,13 +36,15 @@
"artificial": "0.1.x",
"benchmark": "2.1.4",
"body-parser": "1.18.2",
"eslint": "4.19.x",
"eslint-config-airbnb-base": "12.1.x",
"eslint-plugin-import": "2.11.x",
"eslint": "5.x.x",
"eslint-config-airbnb-base": "13.x.x",
"eslint-plugin-import": "2.x.x",
"expect": "23.x.x",
"express": "next",
"faker": "4.1.x",
"jest": "23.x.x"
"is-ci-cli": "^1.1.1",
"jest": "23.x.x",
"jest-runner-eslint": "^0.7.1"
},
"engines": {
"node": ">=8.9.0"
Expand Down
2 changes: 1 addition & 1 deletion test/celebrate.test.js
@@ -1,13 +1,13 @@
/* eslint-env jest */
const expect = require('expect');
const { name, random, date } = require('faker');
const {
celebrate,
Joi,
errors,
isCelebrate,
} = require('../lib');

const { name, random, date } = require('faker');

describe('celebrate()', () => {
describe.each`
Expand Down

0 comments on commit c74849c

Please sign in to comment.