-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(enzyme): add patch to support react 16 context
Enzyme does not support React 16.3 context API. Patch the package until the package is realsed with the fix. enzymejs/enzyme#1513
- Loading branch information
1 parent
a4f6289
commit 3c02acf
Showing
1 changed file
with
35 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
patch-package | ||
--- a/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js | ||
+++ b/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js | ||
@@ -56,6 +56,9 @@ var FunctionalComponent = 1; | ||
var HostPortal = 4; | ||
var HostComponent = 5; | ||
var HostText = 6; | ||
+var Mode = 11; | ||
+var ContextConsumer = 12; | ||
+var ContextProvider = 13; | ||
|
||
function nodeAndSiblingsArray(nodeWithSibling) { | ||
var array = []; | ||
@@ -111,9 +114,6 @@ function toTree(vnode) { | ||
instance: node.stateNode, | ||
rendered: childrenToTree(node.child) | ||
}; | ||
- case Fragment: | ||
- // 10 | ||
- return childrenToTree(node.child); | ||
case FunctionalComponent: | ||
// 1 | ||
return { | ||
@@ -145,6 +145,11 @@ function toTree(vnode) { | ||
case HostText: | ||
// 6 | ||
return node.memoizedProps; | ||
+ case Fragment: // 10 | ||
+ case Mode: // 11 | ||
+ case ContextProvider: // 13 | ||
+ case ContextConsumer: // 12 | ||
+ return childrenToTree(node.child); | ||
default: | ||
throw new Error('Enzyme Internal Error: unknown node with tag ' + String(node.tag)); | ||
} |