Configuration file: Smart Start

The smartStart property of your Wallaby configuration can be used to configure the Smart Start feature with an array of Smart Start Settings objects.

The Smart Start configuration settings are also used to control the behavior of Wallaby’s Exclusive Test Run feature.

Smart Start Settings Object

The Smart Start settings object supports two properties: startMode and pattern. When multiple settings are provided in the smartStart array, the first matching setting will be used.

startMode

The startMode property accepts the following string values:

  • open (default): Start running tests when the test file is opened.
  • edit: Start running tests only after the test file has been edited.
  • always: Start running tests immediately on start (used with pattern).
  • never: Never automatically run tests for the file (tests may still be added manually in VS Code and JetBrains editors using the Exclusive Test Run feature).

Note: settings with the always property are ignored on start when using the Exclusive Test Run feature.

pattern

The pattern glob string property defaults to **/* (which matches all files) and determines which test files Wallaby will apply the startMode setting to.

Example Settings

module.exports = ({
...  
  smartStart: [
    /* On start, run all tests where the 
       filename contains the string: "basic" */
    { startMode: 'always', pattern: '**/*basic*' },

    /* Change the default start mode from "open" 
       to "edit" for all test files */
    { startMode: 'edit' },

    /* Never run any tests where the filename contains
       the string: "database" */
    { startMode: 'never', pattern: '**/*database*' },
  ],
...
]);