This is a setup guide for using VSCode as an IDE for Typescript development.
This article will include what plugin to use for code coverage report, auto code format and hot reload for typescirpt unit tests and application.
VSCode Plugins
You will need these plugins for code coverage report and auto code formatting.
- Coverage Gutter
- Prettier
Nodejs
In the project folder, run these commands
1 |
|
package.json
Edit scripts
Section
1 | "scripts": { |
Add nyc
section
1 | "nyc": { |
mocha.opts
Add mocha.opts
in ./test
1 | --require ts-node/register |
Docker Settings
Dockerfile
1 | FROM node:8-slim |
docker-compose.yml
1 | version: '2' |
Typescript Settings
settings.json
1 | { |
launch.json
1 | { |
task.json
1 | { |
Running the project
In VSCode press F5
(fn + F5
if on a mac), every time you change files in ./app
, it will reload application.
Unit Tests
1 | npm run watch-test |
Code Coverage
Start watching lcov
report
1 | Shift + CMD + 8 |