-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1477 from ljharb/adapter_error
[Fix] improve "bad adapter" error message
- Loading branch information
Showing
4 changed files
with
83 additions
and
32 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
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,29 @@ | ||
/* eslint global-require: 0, import/no-extraneous-dependencies: 0, import/no-unresolved: 0 */ | ||
/** | ||
* This file is needed only because we run our unit tests on multiple | ||
* versions of React at a time. This file basically figures out which | ||
* version of React is loaded, and exports the correct adapter for configuring. | ||
*/ | ||
const { | ||
REACT013, | ||
REACT014, | ||
REACT15, | ||
REACT155, | ||
REACT16, | ||
} = require('./version'); | ||
|
||
let Adapter = null; | ||
|
||
if (REACT013) { | ||
Adapter = require('enzyme-adapter-react-13'); | ||
} else if (REACT014) { | ||
Adapter = require('enzyme-adapter-react-14'); | ||
} else if (REACT155) { | ||
Adapter = require('enzyme-adapter-react-15'); | ||
} else if (REACT15) { | ||
Adapter = require('enzyme-adapter-react-15.4'); | ||
} else if (REACT16) { | ||
Adapter = require('enzyme-adapter-react-16'); | ||
} | ||
|
||
module.exports = Adapter; |
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,31 +1,4 @@ | ||
/* eslint global-require: 0, import/no-extraneous-dependencies: 0, import/no-unresolved: 0 */ | ||
/** | ||
* This file is needed only because we run our unit tests on multiple | ||
* versions of React at a time. This file basically figures out which | ||
* version of React is loaded, and configures enzyme to use the right | ||
* corresponding adapter. | ||
*/ | ||
const { | ||
REACT013, | ||
REACT014, | ||
REACT15, | ||
REACT155, | ||
REACT16, | ||
} = require('./version'); | ||
const Enzyme = require('enzyme'); | ||
|
||
let Adapter = null; | ||
|
||
if (REACT013) { | ||
Adapter = require('enzyme-adapter-react-13'); | ||
} else if (REACT014) { | ||
Adapter = require('enzyme-adapter-react-14'); | ||
} else if (REACT155) { | ||
Adapter = require('enzyme-adapter-react-15'); | ||
} else if (REACT15) { | ||
Adapter = require('enzyme-adapter-react-15.4'); | ||
} else if (REACT16) { | ||
Adapter = require('enzyme-adapter-react-16'); | ||
} | ||
const Adapter = require('./adapter'); | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); |
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