Skip to content

Commit

Permalink
Updated DevTools test setup to no longer mock test renerer
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 26, 2019
1 parent a48593a commit 177f357
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,48 @@ Object {
}
`;
exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (0) 1`] = `
Object {
"inspectedElementID": 3,
"numElements": 4,
"ownerFlatTree": null,
"ownerID": null,
"searchIndex": null,
"searchResults": Array [],
"searchText": "",
"selectedElementID": 3,
"selectedElementIndex": 1,
}
`;
exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (1) 1`] = `
Object {
"inspectedElementID": 4,
"numElements": 4,
"ownerFlatTree": null,
"ownerID": null,
"searchIndex": null,
"searchResults": Array [],
"searchText": "",
"selectedElementID": 4,
"selectedElementIndex": 2,
}
`;
exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (2) 1`] = `
Object {
"inspectedElementID": 5,
"numElements": 4,
"ownerFlatTree": null,
"ownerID": null,
"searchIndex": null,
"searchResults": Array [],
"searchText": "",
"selectedElementID": 5,
"selectedElementIndex": 3,
}
`;
exports[`TreeListContext tree state should select the next and previous elements in the tree: 3: select element after (0) 1`] = `
Object {
"inspectedElementID": 3,
Expand Down
10 changes: 0 additions & 10 deletions packages/react-devtools-shared/src/__tests__/setupEnv.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
'use strict';

// Import test renderer and then reset modules for two reasons:
// 1. We don't want test renderer connected to the DevTools hooks.
// 2. This enables us to work around the on-renderer limitation.
// TODO This (or the resetModules below) might be the cause of the hooks erorr in some tests
const ReactTestRenderer = require.requireActual('react-test-renderer');

jest.resetModules();

jest.mock('react-test-renderer', () => ReactTestRenderer);

// DevTools stores preferences between sessions in localStorage
if (!global.hasOwnProperty('localStorage')) {
global.localStorage = require('local-storage-fallback').default;
Expand Down

0 comments on commit 177f357

Please sign in to comment.