MCPcopy
hub / github.com/ampproject/amphtml / cleanupTestcase

Function cleanupTestcase

testing/init-tests-helpers.js:161–175  ·  view source on GitHub ↗

* Cleans up global state added during tests. * @return {Promise }

()

Source from the content-addressed store, hash-verified

159 * @return {Promise<void>}
160 */
161async function cleanupTestcase() {
162 await flushPreactEffects();
163 setTestRunner(this);
164 restoreConsoleSandbox();
165 restoreAsyncErrorThrows();
166 restoreConsoleError();
167 restoreLogger();
168 cleanupTestPageElements();
169 resetWindowState();
170 setDefaultBootstrapBaseUrlForTesting(null);
171 resetAccumulatedErrorMessagesForTesting();
172 resetExperimentTogglesForTesting(window);
173 resetEvtListenerOptsSupportForTesting();
174 cancelTimersForTesting();
175}
176
177/**
178 * Cleans up any HTML elements that tests might have added to the document.

Callers

nothing calls this directly

Calls 12

setTestRunnerFunction · 0.90
restoreConsoleSandboxFunction · 0.90
restoreConsoleErrorFunction · 0.90
restoreLoggerFunction · 0.90
cancelTimersForTestingFunction · 0.90
restoreAsyncErrorThrowsFunction · 0.85
cleanupTestPageElementsFunction · 0.85
resetWindowStateFunction · 0.85

Tested by

no test coverage detected