-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[refactor] Migrate from Mocha+Chai to Jest #6079
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aeb5eb0
[refactor] Migrate from Mocha+Chai to Jest
xtinec 5fffcf3
Remove the test:one command as it now does the same thing as test.
xtinec 632f92c
Fixing lint errors. The diff looks large but is large done through `y…
xtinec 4606334
Adding eslint-plugin-jest and further modify tests.
xtinec 3437946
- Make istanbul coverage work with Jest.
xtinec b768f36
Attempt to fix dynamic imports in tests.
xtinec c4fc33c
run sequentially and log heap usage
xtinec 1dfe55f
- tweaking maxworkers for travis and specifying coverageDirectory for…
xtinec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
{ | ||
"presets" : ["airbnb", "react", "env"], | ||
"plugins": ["lodash", "syntax-dynamic-import", "react-hot-loader/babel"] | ||
"plugins": ["lodash", "syntax-dynamic-import", "react-hot-loader/babel"], | ||
"env": { | ||
"test": { | ||
"plugins": [ | ||
"babel-plugin-dynamic-import-node" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
testRegex: '\\/spec\\/.*_spec\\.jsx?$', | ||
moduleNameMapper: { | ||
'\\.(css|less)$': '<rootDir>/spec/__mocks__/styleMock.js', | ||
'\\.(gif|ttf|eot|svg)$': '<rootDir>/spec/__mocks__/fileMock.js', | ||
}, | ||
setupTestFrameworkScriptFile: '<rootDir>/spec/helpers/shim.js', | ||
testURL: 'http://localhost', | ||
collectCoverageFrom: ['src/**/*.{js,jsx}'], | ||
coverageDirectory: '<rootDir>/coverage/', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
{ | ||
"plugins": [ | ||
"jest", | ||
"no-only-tests" | ||
], | ||
"env": { | ||
"mocha": true | ||
"jest/globals": true | ||
}, | ||
"extends": ["plugin:jest/recommended"], | ||
"rules": { | ||
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}] | ||
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}], | ||
"jest/consistent-test-it": "error", | ||
"no-only-tests/no-only-tests": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In a future PR I think we can actually also remove
sinon
becausejest
has support for spies, stubs, etc. I doubt that's code-mod-able, tho.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.
Totally agree. I didn't do it in the same PR to limit the scope. :) Yeah, for
sinon
, we need to modify things manually.