Skip to content

Configuration

Latte created as a config-free testing framework. But you can configure it to your needs.

Default configuration

Latte has a default configuration used when no other configuration is provided. This default configuration includes:

{
"include": ["**/*.{test,spec}.{js,ts,jsx,tsx}"],
"exclude": ["node_modules/**"],
"verbose": false,
"dom": false,
"react": false,
"ts": false,
"coverage": false,
"parallel": false,
"watch": false,
"debug": false,
"skip": "",
"test": "",
"reportType": "console",
"reportDir": "coverage",
"reportFile": "",
"maxWorkers": 4,
"progress": "default",
"clearConsole": false,
"showStack": false,
}

You can override the default configuration using command line options or create a config file named latte.json.

CLI options

You can use CLI options to override defaults. To see all available options, run the following command:

Terminal window
latte --help

Available options

  • --version - show version
  • --ts - Enable TypeScript support
  • --include - Patterns for test files
  • --exclude - Patterns for files to exclude
  • -w, --watch – Run in watch mode
  • -p, --parallel – Run tests in parallel
  • -d, --dom – Enable DOM support
  • -r, --react – Enable React support
  • -v, --verbose – Enable verbose mode
  • -c, --coverage – Enable coverage
  • -g, --debug – Enable debug mode
  • -l, --loader – Enable experimental
  • -s, --show-stack – Show the stack trace for failed tests (required verbose)
  • --max-workers - Maximum number of workers to use in parallel mode
  • --report-type - Type of report to generate [lcov, html, junit]
  • --report-dir - Directory to save the report
  • --report-file - File to save the report
  • --skip - Patterns for tests to skip
  • --test - Test name to run
  • --progress - Progress bar type [default, dots, bar]
  • --clear-console - Clear console before testing
  • --init - Create Latte config in the current directory
  • --help - Show help

Example to Run tests

You can run tests using the following command:

Terminal window
latte -d -w
Terminal window
latte --coverage --verbose --include="**/*.test.js" --parallel

Create Latte config

You can create Latte config to configure it to work. To create a config file, use the following command:

Terminal window
latte --init

This will create a file named latte.json in the current directory. You can then edit this file to configure Latte to your needs.

Automatic options enabling

Latte will automatically enable options based on the test files in your project. For example, if you have a file with extension .jsx or .tsx, Latte will automatically enable the --dom and --react options. If you have a file with .ts extension, Latte will automatically enable the --ts option.