Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add canFail option
  • Loading branch information
c4spar committed Apr 4, 2023
commit 8a1f6e0a02f5d6258c3f158981ce58a7107a9c69
6 changes: 4 additions & 2 deletions testing/assert_snapshot_call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface AssertSnapshotCallStep {
stdin?: Array<string> | string;
/** Arguments passed to the test file. */
args?: Array<string>;
/** If enabled, test error will be ignored. */
canFail?: true;
}

export interface AssertSnapshotCallOptions extends AssertSnapshotCallStep {
Expand Down Expand Up @@ -180,9 +182,9 @@ async function runPrompt(
throw assertionError;
}

if (!output.success) {
if (!output.success && !options.canFail && !step?.canFail) {
throw new AssertionError(
`Prompt snapshot test: ${options.meta.url}.` +
`Prompt snapshot test failed: ${options.meta.url}.` +
`Test command failed with a none zero exit code: ${output.code}.\n${
red(stderr ?? "")
}`,
Expand Down