(caseDir, suiteName)
| 99 | * @param {string} suiteName Name of the test suite |
| 100 | */ |
| 101 | const 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 |
no test coverage detected