Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/testing/mod.ts>SnapshotTestOptions

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
interface SnapshotTestOptions
implements SnapshotTestStep
import { type SnapshotTestOptions } from "https://deno.land/x/cliffy@v1.0.0-rc.1/testing/mod.ts";

Snapshot test options.

Properties

name: string

Test name.

Import meta. Required to determine the import url of the test file.

optional
steps: Record<string, SnapshotTestStep>

Object of test steps. Key is the test name and the value is an array of input sequences/characters.

optional
denoArgs: Array<string>

Arguments passed to the deno test command when executing the snapshot tests. --allow-env=SNAPSHOT_TEST_NAME is passed by default.

optional
dir: string

Snapshot output directory. Snapshot files will be written to this directory. This can be relative to the test directory or an absolute path.

If both dir and path are specified, the dir option will be ignored and the path option will be handled as normal.

optional
path: string

Snapshot output path. The snapshot will be written to this file. This can be a path relative to the test directory or an absolute path.

If both dir and path are specified, the dir option will be ignored and the path option will be handled as normal.

optional
osSuffix: Array<Deno.build.os>

Operating system snapshot suffix. This is useful when your test produces different output on different operating systems.

optional
colors: boolean

Enable/disable colors. Default is false.

optional
timeout: number

Timeout in milliseconds to wait until the input stream data is buffered before writing the next data to the stream. This ensures that each user input is rendered as separate line in the snapshot file. If your test gets flaky, try to increase the timeout. The default timeout is 600.

optional
ignore: boolean

If truthy the current test step will be ignored.

It is a quick way to skip over a step, but also can be used for conditional logic, like determining if an environment feature is present.

optional
only: boolean

If at least one test has only set to true, only run tests that have only set to true and fail the test suite.

optional
serializer: (actual: string) => string

Function to use when serializing the snapshot.

Methods

fn(): void | Promise<void>

Test function.