Skip to content

Commit

Permalink
Switch tests to jest
Browse files Browse the repository at this point in the history
jest works with globals so they have to be added to the Eslint configuration.

I decided to move tests next to the files they test (jest picks up files that
are name *.test.js) to make them easier to locate. They need to be ignored by
babel to not show up in the lib folder (that is published to npm).

jest comes with a coverage tool and a watch mode so nyc and npm-watch are no
longer needed.
nickmerwin/node-coveralls#126 (comment)
  • Loading branch information
PhilippBaschke committed Dec 17, 2016
1 parent e91f79b commit adfaf2d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 36 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parserOptions:
env:
node: true
es6: true
jest: true

# Rules
# http://eslint.org/docs/rules/
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ node_modules
# ES5 Code (transpiled by babel)
lib

# nyc (code coverage) output
.nyc_output
# code coverage output
coverage
3 changes: 0 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# ES6 files
src

# Tests
test
29 changes: 8 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@
"lib": "src"
},
"scripts": {
"watch": "npm-watch",
"watch": "jest --watch",
"lint:js": "eslint . --ignore-path .gitignore",
"lint:md": "remark . --quiet --frail",
"lint": "run-p lint:*",
"pretest": "npm run lint",
"tape": "nyc --all tape 'tests/**/*.test.js'",
"test": "npm run tape",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"test": "jest --coverage",
"coverage": "cat ./coverage/lcov.info | coveralls",
"prebuild": "rimraf lib",
"build": "babel src --out-dir lib",
"prepublish": "npm run build"
},
"babel": {
"presets": [
"es2015"
],
"ignore": [
"*.test.js"
]
},
"repository": {
Expand All @@ -47,27 +49,12 @@
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"coveralls": "^2.11.9",
"eslint": "^2.10.2",
"jest": "^18.0.0",
"npm-run-all": "^2.1.1",
"npm-watch": "^0.1.4",
"nyc": "^6.4.4",
"remark": "^4.2.2",
"remark-lint": "^3.2.1",
"rimraf": "^2.5.2",
"tape": "^4.5.1"
},
"nyc": {
"include": "src",
"require": [
"babel-register"
]
},
"watch": {
"tape": {
"patterns": ["src", "tests"],
"quiet": "true"
}
"rimraf": "^2.5.2"
}
}
5 changes: 5 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import convertToStylelint from './index'

it('should not be implemented', () => {
expect(convertToStylelint()).toBe('Not implemented')
})
10 changes: 0 additions & 10 deletions tests/index.test.js

This file was deleted.

0 comments on commit adfaf2d

Please sign in to comment.