-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(*): migrate from enzyme to react-testing-library
- Loading branch information
1 parent
ec04ddd
commit 24a678d
Showing
14 changed files
with
544 additions
and
846 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
var Enzyme = require('enzyme'); | ||
var Adapter = require('enzyme-adapter-react-16'); | ||
// There should be a single listener which simply prints to the | ||
// console. We will wrap that listener in our own listener. | ||
const listeners = window._virtualConsole.listeners('jsdomError'); | ||
const originalListener = listeners && listeners[0]; | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); | ||
window._virtualConsole.removeAllListeners('jsdomError'); | ||
|
||
// Add a new listener to swallow JSDOM errors that originate from clicks on anchor tags. | ||
window._virtualConsole.addListener('jsdomError', (error) => { | ||
if ( | ||
error.type !== 'not implemented' && | ||
error.message !== 'Not implemented: navigation (except hash changes)' && | ||
originalListener | ||
) { | ||
originalListener(error); | ||
} | ||
|
||
// swallow 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
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.