@@ -118,17 +118,26 @@ describe('ReactStatelessComponent', () => {
118118
119119 ReactDOM . render ( < StatelessComponentWithChildContext name = "A" /> , container ) ;
120120
121- expectDev ( console . error . calls . count ( ) ) . toBe ( 2 ) ;
122- expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
123- 'StatelessComponentWithChildContext(...): childContextTypes cannot ' +
124- 'be defined on a functional component.'
125- ) ;
126- expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 1 ) [ 0 ] ) ) . toBe (
127- 'Warning: StatelessComponentWithChildContext.childContextTypes is specified ' +
128- 'but there is no getChildContext() method on the instance. You can either ' +
129- 'define getChildContext() on StatelessComponentWithChildContext or remove ' +
130- 'childContextTypes from it.'
131- ) ;
121+ // Stack and Fiber differ in terms of they show warnings
122+ if ( ReactDOMFeatureFlags . useFiber ) {
123+ expectDev ( console . error . calls . count ( ) ) . toBe ( 1 ) ;
124+ expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
125+ 'StatelessComponentWithChildContext(...): childContextTypes cannot ' +
126+ 'be defined on a functional component.'
127+ ) ;
128+ } else {
129+ expectDev ( console . error . calls . count ( ) ) . toBe ( 2 ) ;
130+ expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
131+ 'StatelessComponentWithChildContext(...): childContextTypes cannot ' +
132+ 'be defined on a functional component.'
133+ ) ;
134+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 1 ) [ 0 ] ) ) . toBe (
135+ 'Warning: StatelessComponentWithChildContext.childContextTypes is specified ' +
136+ 'but there is no getChildContext() method on the instance. You can either ' +
137+ 'define getChildContext() on StatelessComponentWithChildContext or remove ' +
138+ 'childContextTypes from it.'
139+ ) ;
140+ }
132141 } ) ;
133142
134143 if ( ! ReactDOMFeatureFlags . useFiber ) {
0 commit comments