MCPcopy
hub / github.com/webpack/webpack / registerPerCaseSnapshotHooks

Function registerPerCaseSnapshotHooks

test/harness/snapshot/index.js:101–121  ·  view source on GitHub ↗
(caseDir, suiteName)

Source from the content-addressed store, hash-verified

99 * @param {string} suiteName Name of the test suite
100 */
101const registerPerCaseSnapshotHooks = function (caseDir, suiteName) {
102 /** @type {{ caseDir: string, suiteName: string, originalState: SnapshotState, perCaseState: SnapshotState, snapshotPath: string } | undefined} */
103 let snapshotContext;
104
105 beforeAll(() => {
106 snapshotContext = activateSnapshotState(caseDir, suiteName);
107 });
108
109 afterAll(() => {
110 if (!snapshotContext) {
111 return;
112 }
113
114 try {
115 finalizePerCaseSnapshotState(snapshotContext);
116 } finally {
117 deactivateSnapshotState(/** @type {EXPECTED_ANY} */ (snapshotContext));
118 snapshotContext = undefined;
119 }
120 });
121};
122
123/**
124 * Matches `received` against a snapshot stored in a dedicated per-kind

Callers 2

describeCasesFunction · 0.85

Calls 5

beforeAllFunction · 0.85
activateSnapshotStateFunction · 0.85
afterAllFunction · 0.85
deactivateSnapshotStateFunction · 0.85

Tested by

no test coverage detected