()
| 260 | } |
| 261 | |
| 262 | restore() { |
| 263 | if (this.#restore === undefined) { |
| 264 | return; |
| 265 | } |
| 266 | |
| 267 | // Delete the mock CJS cache entry. If the module was previously in the |
| 268 | // cache then restore the old value. |
| 269 | delete Module._cache[this.#restore.fullPath]; |
| 270 | |
| 271 | if (this.#restore.cached) { |
| 272 | Module._cache[this.#restore.fullPath] = this.#restore.value; |
| 273 | } |
| 274 | |
| 275 | const mock = mocks.get(this.#restore.baseURL); |
| 276 | |
| 277 | if (mock !== undefined) { |
| 278 | mock.active = false; |
| 279 | mock.localVersion++; |
| 280 | } |
| 281 | |
| 282 | this.#sharedState.mockMap.delete(this.#restore.baseURL); |
| 283 | this.#sharedState.mockMap.delete(this.#restore.fullPath); |
| 284 | this.#restore = undefined; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | const { restore: restoreModule } = MockModuleContext.prototype; |
no test coverage detected