also looking at this
test: stop leaking mocked module state across test files
#2274
8 files
+77
-67
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | * redirect server (challenge store + reactive issuance kick), and serves the |
| 10 | 10 | * manager's live SNI set on the shared :443 listener. |
| 11 | 11 | */ |
| 12 | import { afterEach, describe, expect, it, spyOn } from 'bun:test' | |
| 12 | import { afterEach, describe, expect, it, mock, spyOn } from 'bun:test' | |
| 13 | 13 | import * as fsp from 'node:fs/promises' |
| 14 | 14 | import * as os from 'node:os' |
| 15 | 15 | import * as path from 'node:path' |
| @@ -21,6 +21,14 @@ const HTTPS_PORT = 49443 | ||
| 21 | 21 | const HTTP_PORT = 49080 |
| 22 | 22 | const REDIRECT_PORT = 49081 |
| 23 | 23 | |
| 24 | // File-level, outside both describes: the spies below are restored only after | |
| 25 | // their assertions, so a throw left them installed (#2270). The second describe | |
| 26 | // needs the REAL startHttpRedirectServer, and other files spy this same | |
| 27 | // namespace, so restore globally between every test in this file. | |
| 28 | afterEach(() => { | |
| 29 | mock.restore() | |
| 30 | }) | |
| 31 | ||
| 24 | 32 | describe('startProxies on-demand TLS wiring', () => { |
| 25 | 33 | let dir: string | undefined |
| 26 | 34 | |