New Test Filtering Feature

  11 Nov 2019   2 min read

Wallaby.js has a new “Test Filtering” feature that allows you to limit the display of inline code coverage indicators and inline run-time values to only the test that you are working on instead of all tests in your project.

Toggling Test Filter in VS Code

While Wallaby previously supported this scenario by only running selected tests, users needed to modify their tests before adding test framework specific hints (e.g. .only(), fit()) and then Wallaby would re-evaluate/re-run all tests in the project.

Today we have added an additional simpler way to focus a single test, the new Toggle Test Filter command. The Toggle Test Filter command provides instant feedback and can be quickly cancelled, allowing you to switch focus between individual tests and their execution results in real-time.

There are several key differences between “Test Filtering” and “Running selected test(s)” that are worth remembering:

  • The Toggle Test Filter command in contrast to it.only/fit does not re-execute your tests when applying/clearing the filter. When you change from only running selected test(s) to running all tests in your project, all tests are re-run; the Toggle Test Filter does not re-run any tests when the filter is set or cleared.
  • The Toggle Test Filter command does not actually change Wallaby’s run-time behavior (after any code change, the minimum set of affected tests will be re-run). In contrast, running selected tests may enable a more efficient workflow for large repositories with many test files, or for slower tests, as Wallaby will only process/run the selected tests.
  • The running selected tests feature supports files, describes and multiple tests selection whereas the Toggle Test Filter command can only be executed for a single test.
  • The Toggle Test Filter command only operates in your editor and does not filter Wallaby App output.

Over the coming weeks we will extend the “Test Filtering” feature to support filtering multiple tests, describes and files in addition to showing the filter state in Wallaby App.

Thanks for reading! As usual, we would love to hear your feedback on Twitter, or via our GitHub repo.

Happy Testing!