Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add internal-test-utils package
Our internal test utils are currently located in the jest-react
package. At one point, the idea was to publish some of these as
public, officially supported APIs, but we abandoned that idea in favor
of `act`. We should really just delete the jest-react package from
our repo.

What we can do instead is put our internal test utils into a private
package. This adds such a package, called internal-test-utils. There are
no exported APIs yet but I'll add some in the next step.
  • Loading branch information
acdlite committed Mar 3, 2023
commit c6009740ee2fc26b469535ee52487e029f7ae6a4
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ module.exports = {
'packages/react-native-renderer/**/*.js',
'packages/eslint-plugin-react-hooks/**/*.js',
'packages/jest-react/**/*.js',
'packages/internal-test-utils/**/*.js',
'packages/**/__tests__/*.js',
'packages/**/npm/*.js',
],
Expand Down
8 changes: 8 additions & 0 deletions packages/internal-test-utils/ReactInternalTestUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* 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.
*/

// TODO: Move `internalAct` and other test helpers to this package
1 change: 1 addition & 0 deletions packages/internal-test-utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ReactInternalTestUtils';
5 changes: 5 additions & 0 deletions packages/internal-test-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"private": true,
"name": "internal-test-utils",
"version": "0.0.0"
}
6 changes: 6 additions & 0 deletions scripts/jest/config.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const NODE_MODULES_DIR =
// Find all folders in packages/* with package.json
const packagesRoot = join(__dirname, '..', '..', 'packages');
const packages = readdirSync(packagesRoot).filter(dir => {
if (dir === 'internal-test-utils') {
// This is an internal package used only for testing. It's OK to read
// from source.
// TODO: Maybe let's have some convention for this?
return false;
}
if (dir.charAt(0) === '.') {
return false;
}
Expand Down