@samitouri / QOS-React-2 / commits / 177f357d9d

Updated DevTools test setup to no longer mock test renerer

Brian Vaughn committed Aug 26, 2019 at 13:46 UTC 177f357d9da5b21050ddd92084a6f0ce67c09e03
2 files changed +42 -10
packages/react-devtools-shared/src/__tests__/__snapshots__/treeContext-test.js.snap
+42
@@ -1091,6 +1091,48 @@ Object {
1091 }
1092 `;
1093
1094 +exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (0) 1`] = `
1095 +Object {
1096 + "inspectedElementID": 3,
1097 + "numElements": 4,
1098 + "ownerFlatTree": null,
1099 + "ownerID": null,
1100 + "searchIndex": null,
1101 + "searchResults": Array [],
1102 + "searchText": "",
1103 + "selectedElementID": 3,
1104 + "selectedElementIndex": 1,
1105 +}
1106 +`;
1107 +
1108 +exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (1) 1`] = `
1109 +Object {
1110 + "inspectedElementID": 4,
1111 + "numElements": 4,
1112 + "ownerFlatTree": null,
1113 + "ownerID": null,
1114 + "searchIndex": null,
1115 + "searchResults": Array [],
1116 + "searchText": "",
1117 + "selectedElementID": 4,
1118 + "selectedElementIndex": 2,
1119 +}
1120 +`;
1121 +
1122 +exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (2) 1`] = `
1123 +Object {
1124 + "inspectedElementID": 5,
1125 + "numElements": 4,
1126 + "ownerFlatTree": null,
1127 + "ownerID": null,
1128 + "searchIndex": null,
1129 + "searchResults": Array [],
1130 + "searchText": "",
1131 + "selectedElementID": 5,
1132 + "selectedElementIndex": 3,
1133 +}
1134 +`;
1135 +
1136 exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (0) 1`] = `
1137 Object {
1138 "inspectedElementID": 3,
packages/react-devtools-shared/src/__tests__/setupEnv.js
-10
@@ -1,15 +1,5 @@
1 'use strict';
2
3 -// Import test renderer and then reset modules for two reasons:
4 -// 1. We don't want test renderer connected to the DevTools hooks.
5 -// 2. This enables us to work around the on-renderer limitation.
6 -// TODO This (or the resetModules below) might be the cause of the hooks erorr in some tests
7 -const ReactTestRenderer = require.requireActual('react-test-renderer');
8 -
9 -jest.resetModules();
10 -
11 -jest.mock('react-test-renderer', () => ReactTestRenderer);
12 -
3 // DevTools stores preferences between sessions in localStorage
4 if (!global.hasOwnProperty('localStorage')) {
5 global.localStorage = require('local-storage-fallback').default;