Skip to Content
ReferenceCommand Line

Command Line

The tstyche command accepts the following options.

Usage

When called without arguments, the tstyche command runs all test files matched by the testFileMatch patterns. To select specific files, pass one or more search strings:

# Run all tests tstyche # Only run the matching test file tstyche query-params

Only files matched by the testFileMatch patterns can be selected this way. The search strings are matched case insensitively against the portion of the path relative to the current directory.

Use the --showConfig command line option to inspect the resolved configuration.

Options

Options passed through the command line override the ones from the configuration file.

An option does not take a value if its type is not specified. Otherwise, how the option value is parsed depends on its type:

  • boolean is interpreted as true if the value is omitted or set to true; or as false if set to false
  • string is simply a string
  • list can hold one or more values separated by commas: --reporters 'list, summary'

Relative paths are resolved relative to the current directory.

--config

  • Type: string

The path to a TSTyche configuration file.

tstyche --config ./config/tstyche.json

--failFast

  • Type: boolean

Stop running tests after the first failure.

--fetch

Fetch the specified versions of the typescript package and exit.

--fetch must be used together with --target or the target configuration option. When --target is provided, those versions are fetched; otherwise the versions from the configuration file are fetched.

tstyche --fetch --target '5.5 || >=5.8'

--help

Print the list of command line options with brief descriptions and exit.

--list

Print the list of supported versions of the typescript package and exit.

--listFiles

Print the list of selected test files and exit.

--only

  • Type: string

Only run tests with a matching name.

The given string is matched against the name of every test() or describe() entry. The matching is case insensitive.

--only does not override the .skip run mode flag. If both --only and --skip filters select a test, it gets skipped.

tstyche --only external

--prune

Remove all fetched versions of the typescript package and exit.

--quiet

  • Type: boolean

Silence all test runner output except errors and warnings.

--reporters

  • Type: list of strings

The list of reporters to use.

The following can be specified:

  • built-in reporter: dot, list or summary
  • name of a package: tstyche-reporter
  • a path: ./custom-reporter.js
tstyche --reporters list,tstyche-reporter,./custom-reporter.js

To learn more, see the Reporters page.

--root

  • Type: string

The path to the root directory of a test project.

To collect the test files, TSTyche walks the file tree starting from the root directory. Later during the test run, TSTyche searches for tsconfig.json starting from the directory containing the test file, up to the root directory.

This means that all test files to be run and TSConfig files to load the compiler configuration from must be within the root directory.

When the --root command line option is set, TSTyche searches for the configuration file in that directory. To avoid this, set an explicit --config path as well:

tstyche --config ./tstyche.json --root ./example

--showConfig

Print the resolved configuration and exit.

--skip

  • Type: string

Skip tests with a matching name.

The given string is matched against the name of every test() or describe() entry. The matching is case insensitive.

--skip overrides the .only run mode flag. If both --skip and --only filters select a test, it gets skipped.

tstyche --skip internal

--target

  • Type: string

The TypeScript version or range of versions to test against.

The following can be specified:

  • a minor release, like 5.6, resolves to the latest version in the series (for example, 5.6 resolves to version 5.6.3)
  • a patch release, like 5.8.2
  • beta, latest, next or rc distribution tags  of the typescript package

To specify multiple versions, provide a single string with versions separated by ||:

tstyche --target '5.6 || 5.8.2 || latest'

Ranges

Version ranges allow testing against a range of TypeScript versions. The range must be specified using an operator and a minor version.

Supported operators:

  • >, greater than
  • >=, greater than or equal
  • <, less than
  • <=, less than or equal

For example, the range >=5.5 gets expanded to: 5.5, 5.6, 5.7 and so on. Newly released versions are added to the list as soon as they become available.

To set an upper bound, the intersection of two ranges can be used: >=5.4 <5.6. In this case, only 5.4 and 5.5 are included.

Ranges and versions can be combined:

tstyche --target '>=5.4 <5.6 || 5.6.2 || >=5.7'

Use the --list command line option to inspect the list of supported versions.

--tsconfig

  • Type: string

The TSConfig to load.

The following can be specified:

  • findup, automatically discovers the nearest tsconfig.json file (default)
  • baseline, uses default compiler options
  • a path, like ./tsconfig.test.json, loads a specific tsconfig.json file
  • an inline JSON string, provides TSConfig directly

If a particular test file is not included in a TSConfig file, TSTyche falls back to default compiler options.

Discover

By default, TSTyche searches for the nearest tsconfig.json that includes the file in question.

tstyche --tsconfig findup

Example output:

uses TypeScript 5.9.3 with ./typetests/tsconfig.json

Use Defaults

Skip TSConfig lookup and use default compiler options.

tstyche --tsconfig baseline

Example output:

uses TypeScript 5.9.3 with baseline TSConfig

Custom TSConfig

Specify a custom tsconfig.json path.

tstyche --tsconfig ./tsconfig.test.json

Example output:

uses TypeScript 5.9.3 with ./tsconfig.test.json

Inline JSON

Provide an inline TSConfig string.

tstyche --tsconfig '{"extends":"./tsconfig.json","compilerOptions":{"lib":["es2020"]},"include":["**/*"]}'

Example output:

uses TypeScript 5.9.3 with inline TSConfig

--update

Fetch the typescript package metadata from the registry and exit.

The list of available TypeScript versions is updated every two hours. Use this option to force the update.

--verbose

  • Type: boolean

Enable detailed logging.

--version

Print the TSTyche version number and exit.

--watch

Watch for changes and rerun related test files.

Files are watched recursively using the fs.watch() method that relies on file system events. In some cases this feature is not available . For example, it does not work on network file systems.

Currently, TSTyche watches the configuration file and the test files.

Last updated on