Skip to content

Commit

Permalink
Improving configuration test file format feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nhenin committed Feb 9, 2024
1 parent 6624e1b commit f480db1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/testing-kit/src/environment/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as t from "io-ts/lib/index.js";
import { readFile } from "fs/promises";
import * as fs from "fs";
import * as path from "path";
import { formatValidationErrors } from "jsonbigint-io-ts-reporters";

const lucidNetworkGuard = t.union([
t.literal("Mainnet"),
t.literal("Preview"),
Expand Down Expand Up @@ -55,7 +57,9 @@ export async function readTestConfiguration(
const configStr = await readFile(filepath, { encoding: "utf-8" });
const result = testConfigurationGuard.decode(JSON.parse(configStr));
if (result._tag === "Left") {
throw new Error("Invalid configuration");
throw new Error(
`Invalid configuration: ${formatValidationErrors(result.left)}`
);
}
return result.right;
}

0 comments on commit f480db1

Please sign in to comment.