Skip to content

Instantly share code, notes, and snippets.

@josephsavona
Created September 27, 2021 18:16
Show Gist options
  • Save josephsavona/91a3d48add8a1c47c71178522583281b to your computer and use it in GitHub Desktop.
Save josephsavona/91a3d48add8a1c47c71178522583281b to your computer and use it in GitHub Desktop.
PASS packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js (18.995 s)
● Console
console.group
⚛️ commit (0b0000000000000000000000000000001)
at console.log (packages/react-reconciler/src/DebugTracing.js:51:27)
console.group
⚛️ commit (0b0000000000000000000000000000001)
at log (packages/react-reconciler/src/DebugTracing.js:51:27)
console.log
We expected 1 warning(s), but saw 0 warning(s).
at log (packages/react-reconciler/src/DebugTracing.js:56:22)
console.log
We expected 1 warning(s), but saw 0 warning(s).
at log (packages/react-reconciler/src/DebugTracing.js:56:22)
console.log
We expected 1 warning(s), but saw 0 warning(s).
at log (packages/react-reconciler/src/DebugTracing.js:56:22)
console.log
We expected 1 warning(s), but saw 0 warning(s).
at log (packages/react-reconciler/src/DebugTracing.js:56:22)
Summary of all failing tests
FAIL packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js
● ReactHooksInspection › should support an injected dispatcher
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'useState' of null"
Received message: "Cannot read properties of null (reading 'useState')"
76 | ): [S, Dispatch<BasicStateAction<S>>] {
77 | const dispatcher = resolveDispatcher();
> 78 | return dispatcher.useState(initialState);
| ^
79 | }
80 |
81 | export function useReducer<S, I, A>(
at Object.useState (packages/react/src/ReactHooks.js:78:21)
at Foo (packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js:260:13)
at Object.inspectHooks (packages/react-debug-tools/src/ReactDebugHooks.js:679:5)
at packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js:281:25
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js:282:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
280 | expect(() => {
281 | ReactDebugTools.inspectHooks(Foo, {}, FakeDispatcherRef);
> 282 | }).toThrow("Cannot read property 'useState' of null");
| ^
283 | }).toErrorDev(
284 | 'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' +
285 | ' one of the following reasons:\n' +
at packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js:282:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js:283:8)
FAIL packages/react-art/src/__tests__/ReactART-test.js
● ReactARTComponents › should warn if radius is missing on a Circle component
Error: Unexpected warning recorded: - Expected
+ Received
Warning: Failed prop type: The prop `radius` is marked as required in `Circle`, but its value is `undefined`.
- in Circle (at **)
+ in <anonymous> (at **)
142 | // We don't throw an Error here though,
143 | // Because it might be suppressed by ReactFiberScheduler.
> 144 | unexpectedWarnings.push(new Error(errorMessage));
| ^
145 | };
146 |
147 | // TODO Decide whether we need to support nested toWarn* expectations.
at consoleSpy (scripts/jest/matchers/toWarnDev.js:144:35)
at printWarning (packages/shared/consoleWithStackDev.js:57:30)
at error (packages/shared/consoleWithStackDev.js:34:7)
at checkPropTypes (packages/shared/checkPropTypes.js:102:42)
at validatePropTypes (packages/react/src/ReactElementValidator.js:231:35)
at Object.createElementWithValidation (packages/react/src/ReactElementValidator.js:484:5)
at packages/react-art/src/__tests__/ReactART-test.js:427:15
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:429:5)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:429:5)
● ReactARTComponents › should warn if width/height is missing on a Rectangle component
Error: Unexpected warning recorded: - Expected
+ Received
Array [
"Warning: Failed prop type: The prop `width` is marked as required in `Rectangle`, but its value is `undefined`.
- in Rectangle (at **)",
- "Warning: Failed prop type: The prop `height` is marked as required in `Rectangle`, but its value is `undefined`.
- in Rectangle (at **)",
+ in <anonymous> (at **)",
]
142 | // We don't throw an Error here though,
143 | // Because it might be suppressed by ReactFiberScheduler.
> 144 | unexpectedWarnings.push(new Error(errorMessage));
| ^
145 | };
146 |
147 | // TODO Decide whether we need to support nested toWarn* expectations.
at consoleSpy (scripts/jest/matchers/toWarnDev.js:144:35)
at printWarning (packages/shared/consoleWithStackDev.js:57:30)
at error (packages/shared/consoleWithStackDev.js:34:7)
at checkPropTypes (packages/shared/checkPropTypes.js:102:42)
at validatePropTypes (packages/react/src/ReactElementValidator.js:231:35)
at Object.createElementWithValidation (packages/react/src/ReactElementValidator.js:484:5)
at packages/react-art/src/__tests__/ReactART-test.js:445:54
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:446:5)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:446:5)
● ReactARTComponents › should warn if outerRadius/startAngle/endAngle is missing on a Wedge component
Error: Unexpected warning recorded: - Expected
+ Received
Array [
"Warning: Failed prop type: The prop `outerRadius` is marked as required in `Wedge`, but its value is `undefined`.
- in Wedge (at **)",
- "Warning: Failed prop type: The prop `startAngle` is marked as required in `Wedge`, but its value is `undefined`.
- in Wedge (at **)",
- "Warning: Failed prop type: The prop `endAngle` is marked as required in `Wedge`, but its value is `undefined`.
- in Wedge (at **)",
+ in <anonymous> (at **)",
]
142 | // We don't throw an Error here though,
143 | // Because it might be suppressed by ReactFiberScheduler.
> 144 | unexpectedWarnings.push(new Error(errorMessage));
| ^
145 | };
146 |
147 | // TODO Decide whether we need to support nested toWarn* expectations.
at consoleSpy (scripts/jest/matchers/toWarnDev.js:144:35)
at printWarning (packages/shared/consoleWithStackDev.js:57:30)
at error (packages/shared/consoleWithStackDev.js:34:7)
at checkPropTypes (packages/shared/checkPropTypes.js:102:42)
at validatePropTypes (packages/react/src/ReactElementValidator.js:231:35)
at Object.createElementWithValidation (packages/react/src/ReactElementValidator.js:484:5)
at packages/react-art/src/__tests__/ReactART-test.js:471:77
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:471:202)
at Object.<anonymous> (packages/react-art/src/__tests__/ReactART-test.js:471:202)
FAIL packages/react/src/__tests__/ReactContextValidator-test.js
● ReactContextValidator › should not warn when class contextType is null
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
580 | static contextType = null; // Handy for conditional declaration
581 | render() {
> 582 | return this.context.hello.world;
| ^
583 | }
584 | }
585 | expect(() => {
at Foo.render (packages/react/src/__tests__/ReactContextValidator-test.js:582:35)
at finishClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1199:31)
at updateClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1128:24)
at beginWork (packages/react-reconciler/src/ReactFiberBeginWork.new.js:3723:16)
at beginWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:2644:49)
at performUnitOfWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1671:12)
at workLoopSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1567:5)
at renderRootSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1525:7)
at performSyncWorkOnRoot (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1072:20)
at flushSyncCallbacks (packages/react-reconciler/src/ReactFiberSyncTaskQueue.new.js:66:22)
at flushSyncWithoutWarningIfAlreadyRendering (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1230:55)
at legacyRenderSubtreeIntoContainer (packages/react-dom/src/client/ReactDOMLegacy.js:177:73)
at Object.render (packages/react-dom/src/client/ReactDOMLegacy.js:297:10)
at Object.renderIntoDocument (packages/react-dom/src/test-utils/ReactTestUtils.js:133:19)
at packages/react/src/__tests__/ReactContextValidator-test.js:586:22
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:587:8)
585 | expect(() => {
586 | ReactTestUtils.renderIntoDocument(<Foo />);
> 587 | }).toThrow("Cannot read property 'world' of undefined");
| ^
588 | });
589 |
590 | it('should warn when class contextType is undefined', () => {
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:587:8)
● ReactContextValidator › should warn when class contextType is undefined
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
594 | static contextType = undefined;
595 | render() {
> 596 | return this.context.hello.world;
| ^
597 | }
598 | }
599 |
at Foo.render (packages/react/src/__tests__/ReactContextValidator-test.js:596:35)
at finishClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1199:31)
at updateClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1128:24)
at beginWork (packages/react-reconciler/src/ReactFiberBeginWork.new.js:3723:16)
at beginWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:2644:49)
at performUnitOfWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1671:12)
at workLoopSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1567:5)
at renderRootSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1525:7)
at performSyncWorkOnRoot (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1072:20)
at flushSyncCallbacks (packages/react-reconciler/src/ReactFiberSyncTaskQueue.new.js:66:22)
at flushSyncWithoutWarningIfAlreadyRendering (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1230:55)
at legacyRenderSubtreeIntoContainer (packages/react-dom/src/client/ReactDOMLegacy.js:177:73)
at Object.render (packages/react-dom/src/client/ReactDOMLegacy.js:297:10)
at Object.renderIntoDocument (packages/react-dom/src/test-utils/ReactTestUtils.js:133:19)
at packages/react/src/__tests__/ReactContextValidator-test.js:602:24
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at packages/react/src/__tests__/ReactContextValidator-test.js:603:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:604:8)
601 | expect(() => {
602 | ReactTestUtils.renderIntoDocument(<Foo />);
> 603 | }).toThrow("Cannot read property 'world' of undefined");
| ^
604 | }).toErrorDev(
605 | 'Foo defines an invalid contextType. ' +
606 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react/src/__tests__/ReactContextValidator-test.js:603:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:604:8)
● ReactContextValidator › should warn when class contextType is an object
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'hello' of undefined"
Received message: "Cannot read properties of undefined (reading 'hello')"
620 | };
621 | render() {
> 622 | return this.context.hello.world;
| ^
623 | }
624 | }
625 |
at Foo.render (packages/react/src/__tests__/ReactContextValidator-test.js:622:29)
at finishClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1199:31)
at updateClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1128:24)
at beginWork (packages/react-reconciler/src/ReactFiberBeginWork.new.js:3723:16)
at beginWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:2644:49)
at performUnitOfWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1671:12)
at workLoopSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1567:5)
at renderRootSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1525:7)
at performSyncWorkOnRoot (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1072:20)
at flushSyncCallbacks (packages/react-reconciler/src/ReactFiberSyncTaskQueue.new.js:66:22)
at flushSyncWithoutWarningIfAlreadyRendering (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1230:55)
at legacyRenderSubtreeIntoContainer (packages/react-dom/src/client/ReactDOMLegacy.js:177:73)
at Object.render (packages/react-dom/src/client/ReactDOMLegacy.js:297:10)
at Object.renderIntoDocument (packages/react-dom/src/test-utils/ReactTestUtils.js:133:19)
at packages/react/src/__tests__/ReactContextValidator-test.js:628:24
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at packages/react/src/__tests__/ReactContextValidator-test.js:629:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:630:8)
627 | expect(() => {
628 | ReactTestUtils.renderIntoDocument(<Foo />);
> 629 | }).toThrow("Cannot read property 'hello' of undefined");
| ^
630 | }).toErrorDev(
631 | 'Foo defines an invalid contextType. ' +
632 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react/src/__tests__/ReactContextValidator-test.js:629:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:630:8)
● ReactContextValidator › should warn when class contextType is a primitive
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
639 | static contextType = 'foo';
640 | render() {
> 641 | return this.context.hello.world;
| ^
642 | }
643 | }
644 |
at Foo.render (packages/react/src/__tests__/ReactContextValidator-test.js:641:35)
at finishClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1199:31)
at updateClassComponent (packages/react-reconciler/src/ReactFiberBeginWork.new.js:1128:24)
at beginWork (packages/react-reconciler/src/ReactFiberBeginWork.new.js:3723:16)
at beginWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:2644:49)
at performUnitOfWork (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1671:12)
at workLoopSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1567:5)
at renderRootSync (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1525:7)
at performSyncWorkOnRoot (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1072:20)
at flushSyncCallbacks (packages/react-reconciler/src/ReactFiberSyncTaskQueue.new.js:66:22)
at flushSyncWithoutWarningIfAlreadyRendering (packages/react-reconciler/src/ReactFiberWorkLoop.new.js:1230:55)
at legacyRenderSubtreeIntoContainer (packages/react-dom/src/client/ReactDOMLegacy.js:177:73)
at Object.render (packages/react-dom/src/client/ReactDOMLegacy.js:297:10)
at Object.renderIntoDocument (packages/react-dom/src/test-utils/ReactTestUtils.js:133:19)
at packages/react/src/__tests__/ReactContextValidator-test.js:647:24
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at packages/react/src/__tests__/ReactContextValidator-test.js:648:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:649:8)
646 | expect(() => {
647 | ReactTestUtils.renderIntoDocument(<Foo />);
> 648 | }).toThrow("Cannot read property 'world' of undefined");
| ^
649 | }).toErrorDev(
650 | 'Foo defines an invalid contextType. ' +
651 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react/src/__tests__/ReactContextValidator-test.js:648:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react/src/__tests__/ReactContextValidator-test.js:649:8)
FAIL packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js (5.108 s)
● ReactHooksWithNoopRenderer › throws when called outside the render phase
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'useState' of null"
Received message: "Cannot read properties of null (reading 'useState')"
76 | ): [S, Dispatch<BasicStateAction<S>>] {
77 | const dispatcher = resolveDispatcher();
> 78 | return dispatcher.useState(initialState);
| ^
79 | }
80 |
81 | export function useReducer<S, I, A>(
at useState (packages/react/src/ReactHooks.js:78:21)
at packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js:263:34
at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:338:21)
at packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js:263:49
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js:266:8)
261 | it('throws when called outside the render phase', () => {
262 | expect(() => {
> 263 | expect(() => useState(0)).toThrow(
| ^
264 | "Cannot read property 'useState' of null",
265 | );
266 | }).toErrorDev(
at packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js:263:49
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js:266:8)
FAIL packages/react-dom/src/__tests__/ReactServerRendering-test.js
● ReactDOMServer › should not warn when class contextType is null
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
1024 | static contextType = null; // Handy for conditional declaration
1025 | render() {
> 1026 | return this.context.hello.world;
| ^
1027 | }
1028 | }
1029 |
at Foo.render (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1026:35)
at finishClassComponent (packages/react-server/src/ReactFizzServer.js:573:31)
at renderClassComponent (packages/react-server/src/ReactFizzServer.js:620:3)
at renderElement (packages/react-server/src/ReactFizzServer.js:940:7)
at renderNodeDestructive (packages/react-server/src/ReactFizzServer.js:1099:11)
at retryTask (packages/react-server/src/ReactFizzServer.js:1448:5)
at performWork (packages/react-server/src/ReactFizzServer.js:1490:7)
at packages/react-server/src/ReactFizzServer.js:1868:66
at scheduleWork (packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js:20:3)
at startWork (packages/react-server/src/ReactFizzServer.js:1868:45)
1030 | expect(() => {
1031 | ReactDOMServer.renderToString(<Foo />);
> 1032 | }).toThrow("Cannot read property 'world' of undefined");
| ^
1033 | });
1034 |
1035 | it('should warn when class contextType is undefined', () => {
at Object.<anonymous> (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1032:8)
● ReactDOMServer › should warn when class contextType is undefined
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
1039 | static contextType = undefined;
1040 | render() {
> 1041 | return this.context.hello.world;
| ^
1042 | }
1043 | }
1044 |
at Foo.render (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1041:35)
at finishClassComponent (packages/react-server/src/ReactFizzServer.js:573:31)
at renderClassComponent (packages/react-server/src/ReactFizzServer.js:620:3)
at renderElement (packages/react-server/src/ReactFizzServer.js:940:7)
at renderNodeDestructive (packages/react-server/src/ReactFizzServer.js:1099:11)
at retryTask (packages/react-server/src/ReactFizzServer.js:1448:5)
at performWork (packages/react-server/src/ReactFizzServer.js:1490:7)
at packages/react-server/src/ReactFizzServer.js:1868:66
at scheduleWork (packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js:20:3)
at startWork (packages/react-server/src/ReactFizzServer.js:1868:45)
1046 | expect(() => {
1047 | ReactDOMServer.renderToString(<Foo />);
> 1048 | }).toThrow("Cannot read property 'world' of undefined");
| ^
1049 | }).toErrorDev(
1050 | 'Foo defines an invalid contextType. ' +
1051 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react-dom/src/__tests__/ReactServerRendering-test.js:1048:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1049:8)
● ReactDOMServer › should warn when class contextType is an object
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'hello' of undefined"
Received message: "Cannot read properties of undefined (reading 'hello')"
1065 | };
1066 | render() {
> 1067 | return this.context.hello.world;
| ^
1068 | }
1069 | }
1070 |
at Foo.render (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1067:29)
at finishClassComponent (packages/react-server/src/ReactFizzServer.js:573:31)
at renderClassComponent (packages/react-server/src/ReactFizzServer.js:620:3)
at renderElement (packages/react-server/src/ReactFizzServer.js:940:7)
at renderNodeDestructive (packages/react-server/src/ReactFizzServer.js:1099:11)
at retryTask (packages/react-server/src/ReactFizzServer.js:1448:5)
at performWork (packages/react-server/src/ReactFizzServer.js:1490:7)
at packages/react-server/src/ReactFizzServer.js:1868:66
at scheduleWork (packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js:20:3)
at startWork (packages/react-server/src/ReactFizzServer.js:1868:45)
1072 | expect(() => {
1073 | ReactDOMServer.renderToString(<Foo />);
> 1074 | }).toThrow("Cannot read property 'hello' of undefined");
| ^
1075 | }).toErrorDev(
1076 | 'Foo defines an invalid contextType. ' +
1077 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react-dom/src/__tests__/ReactServerRendering-test.js:1074:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1075:8)
● ReactDOMServer › should warn when class contextType is a primitive
expect(received).toThrow(expected)
Expected substring: "Cannot read property 'world' of undefined"
Received message: "Cannot read properties of undefined (reading 'world')"
1084 | static contextType = 'foo';
1085 | render() {
> 1086 | return this.context.hello.world;
| ^
1087 | }
1088 | }
1089 |
at Foo.render (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1086:35)
at finishClassComponent (packages/react-server/src/ReactFizzServer.js:573:31)
at renderClassComponent (packages/react-server/src/ReactFizzServer.js:620:3)
at renderElement (packages/react-server/src/ReactFizzServer.js:940:7)
at renderNodeDestructive (packages/react-server/src/ReactFizzServer.js:1099:11)
at retryTask (packages/react-server/src/ReactFizzServer.js:1448:5)
at performWork (packages/react-server/src/ReactFizzServer.js:1490:7)
at packages/react-server/src/ReactFizzServer.js:1868:66
at scheduleWork (packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js:20:3)
at startWork (packages/react-server/src/ReactFizzServer.js:1868:45)
1091 | expect(() => {
1092 | ReactDOMServer.renderToString(<Foo />);
> 1093 | }).toThrow("Cannot read property 'world' of undefined");
| ^
1094 | }).toErrorDev(
1095 | 'Foo defines an invalid contextType. ' +
1096 | 'contextType should point to the Context object returned by React.createContext(). ' +
at packages/react-dom/src/__tests__/ReactServerRendering-test.js:1093:10
at Object.matcher (scripts/jest/matchers/toWarnDev.js:156:11)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.throwingMatcher [as toErrorDev] (node_modules/expect/build/index.js:343:15)
at Object.<anonymous> (packages/react-dom/src/__tests__/ReactServerRendering-test.js:1094:8)
Test Suites: 5 failed, 2 skipped, 270 passed, 275 of 277 total
Tests: 13 failed, 86 skipped, 7380 passed, 7479 total
Snapshots: 124 passed, 124 total
Time: 69.181 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment