File tree Expand file tree Collapse file tree 4 files changed +24
-15
lines changed
react-devtools-shared/src/__tests__
react-devtools-shell/src/app Expand file tree Collapse file tree 4 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -2551,7 +2551,7 @@ describe('InspectedElement', () => {
2551
2551
} ;
2552
2552
2553
2553
await withErrorsOrWarningsIgnored (
2554
- [ 'Warning: Each child in a list should have a unique "key" prop.' ] ,
2554
+ [ 'Each child in a list should have a unique "key" prop.' ] ,
2555
2555
async ( ) => {
2556
2556
await utils . actAsync ( ( ) =>
2557
2557
render ( < Example repeatWarningCount = { 1 } /> ) ,
Original file line number Diff line number Diff line change @@ -154,23 +154,22 @@ beforeEach(() => {
154
154
155
155
const originalConsoleError = console . error ;
156
156
console . error = ( ...args ) => {
157
- const firstArg = args [ 0 ] ;
158
- if (
159
- firstArg === 'Warning: React instrumentation encountered an error: %s'
160
- ) {
157
+ let firstArg = args [ 0 ] ;
158
+ if ( typeof firstArg === 'string' && firstArg . startsWith ( 'Warning: ' ) ) {
159
+ // Older React versions might use the Warning: prefix. I'm not sure
160
+ // if they use this code path.
161
+ firstArg = firstArg . slice ( 9 ) ;
162
+ }
163
+ if ( firstArg === 'React instrumentation encountered an error: %s' ) {
161
164
// Rethrow errors from React.
162
165
throw args [ 1 ] ;
163
166
} else if (
164
167
typeof firstArg === 'string' &&
165
- ( firstArg . startsWith (
166
- "Warning: It looks like you're using the wrong act()" ,
167
- ) ||
168
+ ( firstArg . startsWith ( "It looks like you're using the wrong act()" ) ||
168
169
firstArg . startsWith (
169
- 'Warning: The current testing environment is not configured to support act' ,
170
+ 'The current testing environment is not configured to support act' ,
170
171
) ||
171
- firstArg . startsWith (
172
- 'Warning: You seem to have overlapping act() calls' ,
173
- ) )
172
+ firstArg . startsWith ( 'You seem to have overlapping act() calls' ) )
174
173
) {
175
174
// DevTools intentionally wraps updates with acts from both DOM and test-renderer,
176
175
// since test updates are expected to impact both renderers.
Original file line number Diff line number Diff line change @@ -1927,7 +1927,7 @@ describe('Store', () => {
1927
1927
}
1928
1928
1929
1929
withErrorsOrWarningsIgnored (
1930
- [ 'Warning: Each child in a list should have a unique "key" prop' ] ,
1930
+ [ 'Each child in a list should have a unique "key" prop' ] ,
1931
1931
( ) => {
1932
1932
act ( ( ) => render ( < Example /> ) ) ;
1933
1933
} ,
@@ -1952,7 +1952,7 @@ describe('Store', () => {
1952
1952
}
1953
1953
1954
1954
withErrorsOrWarningsIgnored (
1955
- [ 'Warning: Each child in a list should have a unique "key" prop' ] ,
1955
+ [ 'Each child in a list should have a unique "key" prop' ] ,
1956
1956
( ) => {
1957
1957
act ( ( ) => render ( < Example /> ) ) ;
1958
1958
} ,
Original file line number Diff line number Diff line change @@ -32,8 +32,18 @@ ignoreErrors([
32
32
'Warning: %s is deprecated in StrictMode.' , // findDOMNode
33
33
'Warning: ReactDOM.render was removed in React 19' ,
34
34
'Warning: react-test-renderer is deprecated' ,
35
+ // Ignore prefixed and not prefixed since I don't know which
36
+ // React versions are being tested by this code.
37
+ 'Legacy context API' ,
38
+ 'Unsafe lifecycle methods' ,
39
+ '%s is deprecated in StrictMode.' , // findDOMNode
40
+ 'ReactDOM.render was removed in React 19' ,
41
+ 'react-test-renderer is deprecated' ,
42
+ ] ) ;
43
+ ignoreWarnings ( [
44
+ 'Warning: componentWillReceiveProps has been renamed' ,
45
+ 'componentWillReceiveProps has been renamed'
35
46
] ) ;
36
- ignoreWarnings ( [ 'Warning: componentWillReceiveProps has been renamed' ] ) ;
37
47
ignoreLogs ( [ ] ) ;
38
48
39
49
const unmountFunctions : Array < ( ) => void | boolean > = [ ] ;
You can’t perform that action at this time.
0 commit comments