Skip to content

Commit 8c825f7

Browse files
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
1 parent 9319145 commit 8c825f7

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
patch-package
2+
--- a/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js
3+
+++ b/node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js
4+
@@ -56,6 +56,9 @@ var FunctionalComponent = 1;
5+
var HostPortal = 4;
6+
var HostComponent = 5;
7+
var HostText = 6;
8+
+var Mode = 11;
9+
+var ContextConsumer = 12;
10+
+var ContextProvider = 13;
11+
12+
function nodeAndSiblingsArray(nodeWithSibling) {
13+
var array = [];
14+
@@ -111,9 +114,6 @@ function toTree(vnode) {
15+
instance: node.stateNode,
16+
rendered: childrenToTree(node.child)
17+
};
18+
- case Fragment:
19+
- // 10
20+
- return childrenToTree(node.child);
21+
case FunctionalComponent:
22+
// 1
23+
return {
24+
@@ -145,6 +145,11 @@ function toTree(vnode) {
25+
case HostText:
26+
// 6
27+
return node.memoizedProps;
28+
+ case Fragment: // 10
29+
+ case Mode: // 11
30+
+ case ContextProvider: // 13
31+
+ case ContextConsumer: // 12
32+
+ return childrenToTree(node.child);
33+
default:
34+
throw new Error('Enzyme Internal Error: unknown node with tag ' + String(node.tag));
35+
}

0 commit comments

Comments
 (0)