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 @@ -2556,7 +2556,7 @@ describe('InspectedElement', () => {
25562556 } ;
25572557
25582558 await withErrorsOrWarningsIgnored (
2559- [ 'Warning: Each child in a list should have a unique "key" prop.' ] ,
2559+ [ 'Each child in a list should have a unique "key" prop.' ] ,
25602560 async ( ) => {
25612561 await utils . actAsync ( ( ) =>
25622562 render ( < Example repeatWarningCount = { 1 } /> ) ,
Original file line number Diff line number Diff line change @@ -154,23 +154,22 @@ beforeEach(() => {
154154
155155 const originalConsoleError = console . error ;
156156 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' ) {
161164 // Rethrow errors from React.
162165 throw args [ 1 ] ;
163166 } else if (
164167 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()" ) ||
168169 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' ,
170171 ) ||
171- firstArg . startsWith (
172- 'Warning: You seem to have overlapping act() calls' ,
173- ) )
172+ firstArg . startsWith ( 'You seem to have overlapping act() calls' ) )
174173 ) {
175174 // DevTools intentionally wraps updates with acts from both DOM and test-renderer,
176175 // 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', () => {
19271927 }
19281928
19291929 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' ] ,
19311931 ( ) => {
19321932 act ( ( ) => render ( < Example /> ) ) ;
19331933 } ,
@@ -1952,7 +1952,7 @@ describe('Store', () => {
19521952 }
19531953
19541954 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' ] ,
19561956 ( ) => {
19571957 act ( ( ) => render ( < Example /> ) ) ;
19581958 } ,
Original file line number Diff line number Diff line change @@ -32,8 +32,18 @@ ignoreErrors([
3232 'Warning: %s is deprecated in StrictMode.' , // findDOMNode
3333 'Warning: ReactDOM.render was removed in React 19' ,
3434 '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'
3546] ) ;
36- ignoreWarnings ( [ 'Warning: componentWillReceiveProps has been renamed' ] ) ;
3747ignoreLogs ( [ ] ) ;
3848
3949const unmountFunctions : Array < ( ) => void | boolean > = [ ] ;
You can’t perform that action at this time.
0 commit comments