MCPcopy Index your code
hub / github.com/react/react / subscribeFixtures

Function subscribeFixtures

compiler/packages/snap/src/runner-watch.ts:122–143  ·  view source on GitHub ↗
(
  state: RunnerState,
  onChange: (state: RunnerState) => void,
)

Source from the content-addressed store, hash-verified

120};
121
122function subscribeFixtures(
123 state: RunnerState,
124 onChange: (state: RunnerState) => void,
125) {
126 // Watch the fixtures directory for changes
127 watcher.subscribe(FIXTURES_PATH, async (err, _events) => {
128 if (err) {
129 console.error(err);
130 process.exit(1);
131 }
132 // Try to ignore changes that occurred as a result of our explicitly updating
133 // fixtures in update().
134 // Currently keeps a timestamp of last known changes, and ignore events that occurred
135 // around that timestamp.
136 const isRealUpdate = performance.now() - state.lastUpdate > 5000;
137 if (isRealUpdate) {
138 // Fixtures changed, re-run tests
139 state.mode.action = RunnerAction.Test;
140 onChange(state);
141 }
142 });
143}
144
145function subscribeFilterFile(
146 state: RunnerState,

Callers 1

makeWatchRunnerFunction · 0.85

Calls 3

exitMethod · 0.80
onChangeFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected