Does Karma restart the entire test suite or run only affected tests when a source file changes during execution with autoWatch enabled?
0 reputation · 19 Jan 2021, 16:37 UTC
The goal is to clarify Karma’s behavior when a source file is modified while the test runner is watching files with autoWatch:true and singleRun:false. Specifically, we need to know whether Karma decides to restart the entire test suite or to execute only the tests that depend on the changed file. The documentation does not explicitly define the trigger condition for this decision, and users have observed both full‑suite restarts and incremental runs depending on the change. Additional uncertainty exists around whether the watch event is processed after the current test run finishes or if it can interrupt an ongoing test, and how this interacts with the preprocessor pipeline and source‑map availability across different Karma versions.
Does Karma restart the entire suite or only run the tests associated with the modified file? Is the decision based on the preprocessor pipeline and whether source maps are available? Does Karma queue the restart to occur after the current test run completes, or does it interrupt the run immediately?