• English
  • test

    The rs test command uses Rstest to run tests.

    Usage

    rs test [command] [...filters] [options]

    The command loads the test configuration registered with define.test().

    Options

    rs test supports the same test runtime options and filters as Rstest. See the Rstest CLI documentation and Filtering tests for details.

    Examples:

    # Run a specific test file
    rs test tests/foo.test.ts
    
    # Run tests with names containing "login"
    rs test -t login
    
    # Collect code coverage
    rs test --coverage

    Subcommands

    run

    rs test run runs matching tests once without watch mode. It is suitable for CI environments.

    rs test run

    watch

    rs test watch reruns related tests when a test file or its dependencies change.

    rs test watch

    list

    rs test list lists matching tests without running them.

    rs test list

    merge-reports

    rs test merge-reports merges blob reports generated by multiple test shards.

    rs test merge-reports

    init

    rs test init creates starter files for a supported Rstest project type.

    rs test init browser

    Configuration

    Configure tests through define.test() in the Rstack configuration file. It accepts the standard Rstest configuration:

    rstack.config.ts
    import { define } from 'rstack';
    
    define.app({
      // Shared application configuration
    });
    
    define.test({
      setupFiles: ['./tests/rstest.setup.ts'],
      testEnvironment: 'happy-dom',
    });