Supported technologies: Vitest

Wallaby supports Vitest from v0.14.0 with node v16.12.0+ as a BETA feature.

Vitest is a vite-native unit testing framework that was first released in December, 2021. As a relatively new testing framework, the Vitest team are still often making breaking changes within minor releases, which is why our Vitest support is currently a beta feature.

Please report any issues or feedback to us via our github issues repository.

Select your editor

The content of this page is adjusted based on your editor of choice. Please select your editor by clicking on your editor’s logo below before proceeding:

Starting Wallaby on a project with configured Vitest

To start Wallaby in VS Code you may run Select Configuration command and then select Automatic Configuration <project directory> option once. After that you may keep using Wallaby Start command as usual and it will start Wallaby with automatic configuration.

To start Wallaby in Sublime Text you may use the Select for Wallaby.js Automatic Configuration context menu item for your project folder in the project’s file tree. After that you may keep using Wallaby Start command as usual and it will start Wallaby with automatic configuration.

To start Wallaby in Visual Studio, you may use the Start Wallaby.js (Automatic Configuration) context menu item for your project folder in the Solution Explorer. After the first start, the selected project will be remembered for your solution and Wallaby can be started with Tools->Start Wallaby.js (Alt-W, 1).

To start Wallaby in JetBrains IDEs, you may edit (or create a new) wallaby.js Run Configuration by selecting Edit configurations from the drop-down menu in the top right-hand corner of the navigation bar, or from the Run menu. In the run configuration editor set Configuration Type filed value to Automatic.

Overriding Automatic Configuration

Sometimes you may want to add/override some Wallaby configuration settings to the automatically detected settings. For example, if you want to exclude some tests when you are using Wallaby but not when you are running tests from the command-line or Continuous Integration build. You may configure an override in a configuration file or package.json section.

After creating Wallaby config file to override automatic defaults in VS Code you need to run Select Configuration command and then select the config file once. After that you may keep using Wallaby Start command as usual and it will start Wallaby with the configuration file.

After creating Wallaby config file to override automatic defaults in JetBrains IDEs, you may edit (or create a new) wallaby.js Run Configuration by selecting Edit configurations from the drop-down menu in the top right-hand corner of the navigation bar, or from the Run menu. In the run configuration editor set Configuration Type filed value to Configuration File.

Note that if you are adding/overriding files/tests, then you need to add the autoDetect: true setting:

module.exports = () => ({
  autoDetect: true,
  files: [...],
  tests: [...],
});

Troubleshooting

The first step of troubleshooting a project configured to use automatic configuration is to identify whether the same results are returned using npx vitest. Running vitest from the command-line will usually show/highlight the cause of your problem.

If Wallaby is not working with vitest, then you may like to try to downgrade to an earlier version of vitest to see if that fixes your problem. If this does fix your problem, please report this issue to the Wallaby team.

If you get stuck or something isn’t working for you, you may find further troubleshooting steps here or else find a similar solved issue in our github issues repository. If you can’t find a solution, create a new issue.