[test] Exclude repository root from assertions (#35361)

This commit is contained in:
Sebastian "Sebbie" Silbermann
2025-12-15 11:45:17 +01:00
committed by GitHub
parent b061b597f7
commit ba5b843692
5 changed files with 27 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ const {
resetAllUnexpectedConsoleCalls,
patchConsoleMethods,
} = require('internal-test-utils/consoleMock');
const path = require('path');
if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
// Inside the class equivalence tester, we have a custom environment, let's
@@ -18,6 +19,9 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
const spyOn = jest.spyOn;
const noop = jest.fn;
// Can be used to normalize paths in stackframes
global.__REACT_ROOT_PATH_TEST__ = path.resolve(__dirname, '../..');
// Spying on console methods in production builds can mask errors.
// This is why we added an explicit spyOnDev() helper.
// It's too easy to accidentally use the more familiar spyOn() helper though,