| ... | @@ -96,16 +96,19 @@ describe("VcsProjectConfig", () => { | ... | @@ -96,16 +96,19 @@ describe("VcsProjectConfig", () => { |
| 96 | const kind = yield* config.resolveKind({ cwd }); | 96 | const kind = yield* config.resolveKind({ cwd }); |
| 97 | | 97 | |
| 98 | assert.equal(kind, "jj"); | 98 | assert.equal(kind, "jj"); |
| 99 | const [message, context] = messages[0] as [string, Record<string, unknown>]; | | |
| 100 | const failedCandidate = path.join(cwd, ".t3code", "vcs.json"); | 99 | const failedCandidate = path.join(cwd, ".t3code", "vcs.json"); |
| 101 | assert.equal(message, "Failed to inspect VCS project config at " + failedCandidate + "."); | 100 | const [error] = messages[0] as ReadonlyArray<unknown>; |
| 102 | assert.deepInclude(context, { | 101 | assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError); |
| | 102 | assert.equal( |
| | 103 | error.message, |
| | 104 | "Failed to inspect VCS project config at " + failedCandidate + ".", |
| | 105 | ); |
| | 106 | assert.deepInclude(error, { |
| 103 | operation: "inspect", | 107 | operation: "inspect", |
| 104 | cwd, | 108 | cwd, |
| 105 | configPath: failedCandidate, | 109 | configPath: failedCandidate, |
| 106 | errorTag: "VcsProjectConfigError", | 110 | _tag: "VcsProjectConfigError", |
| 107 | }); | 111 | }); |
| 108 | assert.equal("cause" in context, false); | | |
| 109 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); | 112 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); |
| 110 | }); | 113 | }); |
| 111 | }); | 114 | }); |
| ... | @@ -146,18 +149,19 @@ describe("VcsProjectConfig", () => { | ... | @@ -146,18 +149,19 @@ describe("VcsProjectConfig", () => { |
| 146 | const kind = yield* config.resolveKind({ cwd: root }); | 149 | const kind = yield* config.resolveKind({ cwd: root }); |
| 147 | | 150 | |
| 148 | assert.equal(kind, "auto"); | 151 | assert.equal(kind, "auto"); |
| 149 | const [message, context] = messages[0] as [string, Record<string, unknown>]; | 152 | const [error] = messages[0] as ReadonlyArray<unknown>; |
| | 153 | assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError); |
| 150 | assert.equal( | 154 | assert.equal( |
| 151 | message, | 155 | error.message, |
| 152 | "Failed to decode VCS project config at " + path.join(configDir, "vcs.json") + ".", | 156 | "Failed to decode VCS project config at " + path.join(configDir, "vcs.json") + ".", |
| 153 | ); | 157 | ); |
| 154 | assert.deepInclude(context, { | 158 | assert.deepInclude(error.cause, { _tag: "SchemaError" }); |
| | 159 | assert.deepInclude(error, { |
| 155 | operation: "decode", | 160 | operation: "decode", |
| 156 | cwd: root, | 161 | cwd: root, |
| 157 | configPath: path.join(configDir, "vcs.json"), | 162 | configPath: path.join(configDir, "vcs.json"), |
| 158 | errorTag: "VcsProjectConfigError", | 163 | _tag: "VcsProjectConfigError", |
| 159 | }); | 164 | }); |
| 160 | assert.equal("cause" in context, false); | | |
| 161 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); | 165 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); |
| 162 | }); | 166 | }); |
| 163 | }); | 167 | }); |
| ... | @@ -182,15 +186,16 @@ describe("VcsProjectConfig", () => { | ... | @@ -182,15 +186,16 @@ describe("VcsProjectConfig", () => { |
| 182 | const kind = yield* config.resolveKind({ cwd: root }); | 186 | const kind = yield* config.resolveKind({ cwd: root }); |
| 183 | | 187 | |
| 184 | assert.equal(kind, "auto"); | 188 | assert.equal(kind, "auto"); |
| 185 | const [message, context] = messages[0] as [string, Record<string, unknown>]; | 189 | const [error] = messages[0] as ReadonlyArray<unknown>; |
| 186 | assert.equal(message, "Failed to read VCS project config at " + configPath + "."); | 190 | assert.instanceOf(error, VcsProjectConfig.VcsProjectConfigError); |
| 187 | assert.deepInclude(context, { | 191 | assert.equal(error.message, "Failed to read VCS project config at " + configPath + "."); |
| | 192 | assert.deepInclude(error.cause, { _tag: "PlatformError" }); |
| | 193 | assert.deepInclude(error, { |
| 188 | operation: "read", | 194 | operation: "read", |
| 189 | cwd: root, | 195 | cwd: root, |
| 190 | configPath, | 196 | configPath, |
| 191 | errorTag: "VcsProjectConfigError", | 197 | _tag: "VcsProjectConfigError", |
| 192 | }); | 198 | }); |
| 193 | assert.equal("cause" in context, false); | | |
| 194 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); | 199 | }).pipe(Effect.provide(Logger.layer([logger], { mergeWithExisting: false }))); |
| 195 | }); | 200 | }); |
| 196 | }); | 201 | }); |