mockAllConfigs() — react Function Reference
Architecture documentation for the mockAllConfigs() function in setupHostConfigs.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD c6ea4dc2_6e23_0a2d_48aa_08e82ffba04a["mockAllConfigs()"] 453c2a4b_eadd_4b72_cc97_406b0eb158f2["setupHostConfigs.js"] c6ea4dc2_6e23_0a2d_48aa_08e82ffba04a -->|defined in| 453c2a4b_eadd_4b72_cc97_406b0eb158f2 style c6ea4dc2_6e23_0a2d_48aa_08e82ffba04a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/jest/setupHostConfigs.js lines 188–213
function mockAllConfigs(rendererInfo) {
configPaths.forEach(path => {
// We want the reconciler to pick up the host config for this renderer.
jest.mock(path, () => {
let idx = path.lastIndexOf('/');
let forkPath = path.slice(0, idx) + '/forks' + path.slice(idx);
let parts = rendererInfo.shortName.split('-');
while (parts.length) {
try {
const candidate = `${forkPath}.${parts.join('-')}.js`;
fs.statSync(nodePath.join(process.cwd(), 'packages', candidate));
return jest.requireActual(candidate);
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
// try without a part
}
parts.pop();
}
throw new Error(
`Expected to find a fork for ${path} but did not find one.`
);
});
});
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does mockAllConfigs() do?
mockAllConfigs() is a function in the react codebase, defined in scripts/jest/setupHostConfigs.js.
Where is mockAllConfigs() defined?
mockAllConfigs() is defined in scripts/jest/setupHostConfigs.js at line 188.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free