test: tighten browser and memory path assertions · openclaw/openclaw@cdc8247
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,14 @@ async function withTempDir<T>(run: (tempDir: string) => Promise<T>): Promise<T>
|
14 | 14 | } |
15 | 15 | |
16 | 16 | async function expectPathMissing(targetPath: string): Promise<void> { |
17 | | -await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 17 | +let error: unknown; |
| 18 | +try { |
| 19 | +await fs.access(targetPath); |
| 20 | +} catch (caught) { |
| 21 | +error = caught; |
| 22 | +} |
| 23 | +expect(error).toBeInstanceOf(Error); |
| 24 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
18 | 25 | } |
19 | 26 | |
20 | 27 | describe("ensureOutputDirectory", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -104,7 +104,14 @@ describe("pw-tools-core", () => {
|
104 | 104 | } |
105 | 105 | |
106 | 106 | async function expectPathMissing(targetPath: string): Promise<void> { |
107 | | -await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 107 | +let error: unknown; |
| 108 | +try { |
| 109 | +await fs.access(targetPath); |
| 110 | +} catch (caught) { |
| 111 | +error = caught; |
| 112 | +} |
| 113 | +expect(error).toBeInstanceOf(Error); |
| 114 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
108 | 115 | } |
109 | 116 | |
110 | 117 | function createDownloadEventHarness() { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,14 @@ describe("compileMemoryWikiVault", () => {
|
27 | 27 | } |
28 | 28 | |
29 | 29 | async function expectPathMissing(targetPath: string): Promise<void> { |
30 | | -await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 30 | +let error: unknown; |
| 31 | +try { |
| 32 | +await fs.access(targetPath); |
| 33 | +} catch (caught) { |
| 34 | +error = caught; |
| 35 | +} |
| 36 | +expect(error).toBeInstanceOf(Error); |
| 37 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
31 | 38 | } |
32 | 39 | |
33 | 40 | function expectDigestPage<T extends { path: string }>(pages: T[], pagePath: string): T { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。