run() — react Function Reference
Architecture documentation for the run() function in snapshot-test.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 9cf67ff4_11dc_a41a_7ffb_b842e2e6f5fc["run()"] 5e237243_922c_f658_a1ac_5ecfee0d76d0["snapshot-test.js"] 9cf67ff4_11dc_a41a_7ffb_b842e2e6f5fc -->|defined in| 5e237243_922c_f658_a1ac_5ecfee0d76d0 style 9cf67ff4_11dc_a41a_7ffb_b842e2e6f5fc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/release/snapshot-test.js lines 17–106
const run = async () => {
const defaultOptions = {
cwd,
env: process.env,
};
try {
// Start with a known build/revision:
// https://circleci.com/gh/facebook/react/12707
let promise = spawn(
'node',
[
'./scripts/release/prepare-release-from-ci.js',
`--build=${CIRCLE_CI_BUILD}`,
],
defaultOptions
);
logPromise(
promise,
theme`Checking out "next" build {version ${CIRCLE_CI_BUILD}}`
);
await promise;
const dateString = await getDateStringForCommit(COMMIT);
// Upgrade the above build top a known React version.
// Note that using the --local flag skips NPM checkout.
// This isn't totally necessary but is useful if we want to test an unpublished "next" build.
promise = spawn(
'node',
[
'./scripts/release/prepare-release-from-npm.js',
`--version=0.0.0-${COMMIT}-${dateString}`,
'--local',
],
defaultOptions
);
promise.childProcess.stdin.setEncoding('utf-8');
promise.childProcess.stdout.setEncoding('utf-8');
promise.childProcess.stdout.on('data', data => {
if (data.includes('✓ Version for')) {
// Update all packages to a stable version
promise.childProcess.stdin.write(VERSION);
} else if (data.includes('(y/N)')) {
// Accept all of the confirmation prompts
promise.childProcess.stdin.write('y');
}
});
logPromise(promise, theme`Preparing stable release {version ${VERSION}}`);
await promise;
const beforeContents = readFileSync(
join(cwd, 'scripts/release/snapshot-test.snapshot'),
'utf-8'
);
await exec('cp build/temp.diff scripts/release/snapshot-test.snapshot', {
cwd,
});
const afterContents = readFileSync(
join(cwd, 'scripts/release/snapshot-test.snapshot'),
'utf-8'
);
if (beforeContents === afterContents) {
console.log(theme.header`Snapshot test passed.`);
} else {
printDiff(
'scripts/release/snapshot-test.snapshot',
beforeContents,
afterContents
);
console.log();
console.error(theme.error('Snapshot test failed!'));
console.log();
console.log(
'If this failure was expected, please update the contents of the snapshot file:'
);
console.log(
theme` {command git add} {path scripts/release/snapshot-test.snapshot}`
);
console.log(
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does run() do?
run() is a function in the react codebase, defined in scripts/release/snapshot-test.js.
Where is run() defined?
run() is defined in scripts/release/snapshot-test.js at line 17.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free