Skip to content

Commit f260bcf

Browse files
committed
Add named hooks test case built with Rollup
1 parent ed6c091 commit f260bcf

File tree

11 files changed

+115
-7
lines changed

11 files changed

+115
-7
lines changed

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/bundle/index.js

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/bundle/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/ComponentWithCustomHook.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/ComponentWithCustomHook.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/ComponentWithCustomHook.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
*/
9+
10+
// export {Component as ComponentWithCustomHook} from './ComponentWithCustomHook';
11+
// export {Component as ComponentWithExternalCustomHooks} from './ComponentWithExternalCustomHooks';
12+
export {Component as Example} from './Example';
13+
// export {Component as InlineRequire} from './InlineRequire';
14+
// import * as ToDoList from './ToDoList';
15+
// export {ToDoList};
16+
// export {default as useTheme} from './useTheme';

packages/react-devtools-extensions/src/__tests__/parseHookNames-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ describe('parseHookNames', () => {
185185
]);
186186
});
187187

188-
describe('inline and external source maps', () => {
188+
describe('inline, external and bundle source maps', () => {
189189
it('should work for simple components', async () => {
190-
async function test(path) {
191-
const Component = require(path).Component;
190+
async function test(path, name = 'Component') {
191+
const Component = require(path)[name];
192192
const hookNames = await getHookNamesForComponent(Component);
193193
expectHookNamesToEqual(hookNames, [
194194
'count', // useState
@@ -198,6 +198,7 @@ describe('parseHookNames', () => {
198198
await test('./__source__/Example'); // original source (uncompiled)
199199
await test('./__source__/__compiled__/inline/Example'); // inline source map
200200
await test('./__source__/__compiled__/external/Example'); // external source map
201+
await test('./__source__/__compiled__/bundle/index', 'Example'); // bundle source map
201202
});
202203

203204
it('should work with more complex files and components', async () => {

0 commit comments

Comments
 (0)