Skip to content

Commit

Permalink
Tests: Replace mocha with jest
Browse files Browse the repository at this point in the history
Closes #3.
  • Loading branch information
overlookmotel committed Jan 29, 2019
1 parent 052972d commit caac649
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 24 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
node_modules
/test
coverage
npm-debug.log
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
test
coverage
.editorconfig
.gitattributes
.gitignore
.eslintignore
.eslintrc.js
.npmignore
.travis.yml
jest.config.js
npm-debug.log
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use_strict';

module.exports = {
testEnvironment: 'node',
clearMocks: true,
coverageDirectory: 'coverage',
collectCoverageFrom: [
'*.js',
'lib/**/*.js',
'!jest.config.js'
]
};
24 changes: 10 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
"react": "^16.7.0"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@overlookmotel/eslint-config": "^1.1.0",
"@overlookmotel/eslint-config-react": "^1.0.0",
"@overlookmotel/eslint-config-tests": "^1.0.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coveralls": "^3.0.2",
Expand All @@ -35,13 +36,11 @@
"eslint-plugin-chai-friendly": "^0.4.1",
"eslint-plugin-eslint-comments": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"istanbul": "^0.4.5",
"mocha": "^5.2.0",
"jest": "^23.6.0",
"prop-types": "^15.6.2",
"react": "^16.7.0",
"sinon": "^7.2.3",
"sinon-chai": "^3.3.0",
"source-map-support": "^0.5.10"
"sinon-chai": "^3.3.0"
},
"keywords": [
"react",
Expand All @@ -53,18 +52,15 @@
"async"
],
"scripts": {
"build": "rm -rf test/* && npm run build-only",
"build-only": "babel src --out-dir .",
"test": "npm run lint && npm run test-main",
"lint": "eslint *.js .*.js lib/** src/** --ext .js",
"lint-fix": "eslint *.js .*.js lib/** src/** --ext .js --fix",
"test-main": "npm run build && npm run test-only && npm run test-only-prod",
"test-only": "cross-env NODE_ENV=development mocha --require source-map-support/register --check-leaks --colors -t 1000 -R spec 'test/**/*.test.js'",
"test-only-prod": "cross-env NODE_ENV=production mocha --require source-map-support/register --check-leaks --colors -t 1000 -R spec 'test/**/*.test.js'",
"lint": "eslint *.js .*.js lib/** test/** --ext .js",
"lint-fix": "eslint *.js .*.js lib/** test/** --ext .js --fix",
"test-main": "npm run test-only && npm run test-only-prod",
"test-only": "cross-env NODE_ENV=development jest",
"test-only-prod": "cross-env NODE_ENV=production jest",
"cover": "npm run cover-main && rm -rf coverage",
"coveralls": "npm run cover-main && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
"cover-main": "npm run build && npm run cover-only",
"cover-only": "cross-env COVERAGE=true istanbul cover _mocha --report lcovonly -- -t 1000 -R spec 'test/**/*.test.js'",
"cover-main": "cross-env COVERAGE=true NODE_ENV=development jest --coverage",
"ci": "if [ $COVERAGE ]; then npm run coveralls; else npm test; fi"
},
"engines": {
Expand Down
9 changes: 0 additions & 9 deletions src/test/.babelrc.js

This file was deleted.

8 changes: 8 additions & 0 deletions test/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-react'
]
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit caac649

Please sign in to comment.