-
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
Conversation
const packageJSON = require('./package.json'); | ||
|
||
process.env.TZ = 'UTC'; | ||
|
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.
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 comment
The 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
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
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 comment
The 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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
ideally, I would like to name it test
but to avoid pilling up too many changes in 1 PR. I've decided to leave if backward compatible.
looks fine to me, thanks for this! |
Description
This PR contains all the changes to make tests run with Jest.
I've removed mocha and chai as well.
Considerations
If this PR is merged we will not need to merge closes #189 🎉