-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove react-test-renderer/shallow export (#28497)
Based on - #28419 ## Summary The shallow renderer was extracted from the repo years ago and published by enzyme: https://github.com/enzymejs/react-shallow-renderer We no longer need to reexport under the react-test-renderer namespace. People can import `react-shallow-renderer` as needed ## How did you test this change? - Observe shallow.js in react-test-renderer package from standard build - Run build with changes on this branch - Observe no more shallow.js export in build output
- Loading branch information
Showing
5 changed files
with
31 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
describe('shallow', () => { | ||
it('throws an error on init', () => { | ||
const ReactShallowRenderer = require('../shallow.js').default; | ||
expect(() => { | ||
// eslint-disable-next-line no-new | ||
new ReactShallowRenderer(); | ||
}).toThrow( | ||
'react-test-renderer/shallow has been removed. See https://react.dev/warnings/react-test-renderer.' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = require('react-shallow-renderer'); | ||
function ReactShallowRenderer() { | ||
throw new Error( | ||
'react-test-renderer/shallow has been removed. See https://react.dev/warnings/react-test-renderer.' | ||
); | ||
} | ||
|
||
module.exports = ReactShallowRenderer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters