Skip to content

test_runner: fix support watch with run(), add globPatterns option

This PR fixes one regression I found when using run({ watch: true }): a different test was run after a file rename.

This was caused by calling createTestFileList() from the changed event handler in https://github.com/nodejs/node/blob/362afa52ebe462a39874915e5e70d261db153c58/lib/internal/test_runner/runner.js#L423.

The problem is that createTestFileList() was loading the glob pattern from argv, which can be whatever. The result was but that was very hard to track.

This PR includes:

  • tests for run({ watch: true })
  • a new option called globPatterns that will allow users to control what run() will be globbing
  • avoid tracking "rename" changes if individual files were specified

Merge request reports

Loading