hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
90 stars 31 forks source link

Needs to watch for file changes #118

Open kingsimba opened 4 years ago

kingsimba commented 4 years ago

Use Cases

In the following use cases, I hope related tests can be refreshed automatically.

  1. Use an external editor to modify a JS file. TortoiseGit for example.
  2. Use TypeScript for coding and compile to JavaScript for testing(with 'tsc --watch').

Additional info

I know this has been discussed a lot, as in #69. But I found no dedicated report on it. So I created this to emphasize its importance and exicite more disscussion.

Suggestions

The best approach, I think, is to watch for JS files which are generated from TS files in the project. It has the advantage of ignoring junk JS files which are results of renaming TS files.

The second cancidate it to read options from Mocha's option file: https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.jsonc

hbenl commented 3 years ago

In version 2.13.0 you can configure a watcher for triggering reloads with the mochaExplorer.watch config option. I have added some documentation to the section on using transpilers. This is still experimental, so please tell me if it works for you.