Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/testPublic

test helpers for oclif components

License

NotificationsYou must be signed in to change notification settings

oclif/test

Repository files navigation

test helpers for oclif CLIs

VersionDownloads/weekLicense

Migration

See theV4 Migration Guide if you are migrating from v3 or older.

Usage

@oclif/test provides a handful of utilities that make it easy to test youroclif CLI.

Note

In order for these utilities to capture all output to the terminal, you must disable any console output interception/suppression features in your test framework.

captureOutput

captureOutput allows you to get the stdout, stderr, return value, and error of the callback you provide it. This makes it possible to assert that certain strings were printed to stdout and stderr or that the callback failed with the expected error or succeeded with the expected result.

Options

  • print - Print everything that goes to stdout and stderr.
  • stripAnsi - Strip ansi codes from everything that goes to stdout and stderr. Defaults to true.
  • testNodeEnv - Sets theNODE_ENV value when capturing output. Defaults to'test'.

See thetests for example usage.

runCommand

runCommand allows you to get the stdout, stderr, return value, and error of a command in your CLI.

See thetests for example usage.

runHook

runHook allows you to get the stdout, stderr, return value, and error of a hook in your CLI.

See thetests for example usage.


[8]ページ先頭

©2009-2025 Movatter.jp