-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: convert mocha to jest #190
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
], | ||
|
||
"env": { | ||
"jest": true, | ||
"browser": true, | ||
"es6": true, | ||
"node": true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const packageJSON = require('./package.json'); | ||
|
||
process.env.TZ = 'UTC'; | ||
|
||
module.exports = { | ||
verbose: true, | ||
name: packageJSON.name, | ||
displayName: packageJSON.name, | ||
transform: { | ||
'\\.[jt]sx?$': 'babel-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've left tsx? there because it helps to my next step of moving everything to TS |
||
testURL: 'http://localhost', | ||
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'], | ||
testMatch: ['**/*.(spec|test).js'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've used spec as a postfix on the files because IMO is easy to filter tests from other files without looking at the path. Also helps when there's a need for adding other files (ex: helpers) to the test directory without having to filter those in the configuration. |
||
collectCoverage: true, | ||
coverageDirectory: './coverage/', | ||
}; |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,6 @@ | |
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"options": { | ||
"mocha": "--require babel-register --require scripts/mocha-bootload src/**/__tests__/*.js" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"babelify" | ||
|
@@ -33,7 +30,7 @@ | |
"start": "node lib/server", | ||
"watch": "babel scripts/watch.js | node", | ||
"test": "npm run lint && npm run check && npm run test:only", | ||
"test:only": "mocha $npm_package_options_mocha", | ||
"test:only": "jest", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ideally, I would like to name it |
||
"lint": "eslint src handler", | ||
"lint:fix": "eslint --fix src handler", | ||
"check": "flow check", | ||
|
@@ -58,25 +55,26 @@ | |
"graphql-relay": "0.6.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.3", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^10.0.3", | ||
"babel-jest": "^26.6.3", | ||
"babel-plugin-syntax-async-functions": "6.13.0", | ||
"babel-plugin-syntax-object-rest-spread": "^6.13.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.4", | ||
"eslint": "^5.16.0", | ||
"eslint-plugin-babel": "5.3.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"flow-bin": "^0.69.0", | ||
"isomorphic-fetch": "2.2.1", | ||
"isparta": "^4.1.1", | ||
"mocha": "^6.1.4", | ||
"jest": "^26.6.3", | ||
"netlify-lambda": "^1.6.3", | ||
"prettier": "^1.18.2", | ||
"sane": "^4.1.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is useful to avoid dealing with dates changing when running under CI systems.