Closed rallets closed 3 years ago
You should use a watcher, that will transpile each change as soon as you save it (and will be a lot faster than starting tsc
and transpiling all sources every time). It's available by default as a task in VSCode: go to the Command palette and select "Tasks: Run Task" -> "typescript" -> "tsc: watch".
So there is no configuration (kind of trampoline) available in the adapter? is the watcher the only option? (so I can avoid that extra manual step)
No, the adapter currently doesn't have such an option. If you want to avoid the extra manual step, you can configure the watcher to be run automatically (see here, in fact I use such a watcher task for this extension). Alternatively you can run your tests using ts-node
(e.g. by adding "require": "ts-node/register/transpile-only"
to .mocharc.json
), then your sources will be compiled on-the-fly every time you run your tests (with the obvious performance hit).
Hi, I'm using typescript and Mocha test adapter to run some unit tests in VS Code, it's a great tool! Everything works fine but I need to transpile the typescript code manually (via
npx tsc
) every time I edit the code... that's a bit annoying. If I don't do that, the test will run on the old transpilation. There is a way to run something likenpx tsc
before a test run? or am I missing a configuration somewhere? Thank you