Skip to main content

Running and Debugging

Running An Assignment in VSCode

Assignments do not have main methods, but they do have main.ts files. This is the "entry point" of your program. To run it, simply use the npm run start command in your assignments terminal (open up the assignment folder, Terminal -> New Terminal).

Above is an example run of a working solution for the first homework.

Debugging in VSCode

From Wikipedia on Debuggers

A debugger or debugging tool is a computer program used to test and debug other programs (the "target" program). The main use of a debugger is to run the target program under controlled conditions that permit the programmer to track its execution and monitor changes in computer resources that may indicate malfunctioning code.

If you have never used a debugger before, then now is a great time to start. They are extremely useful and can help you quickly find bugs in your program.

Provided with each assignment is a VSCode launch configuration to debug your code (.vscode/launch.json). To start your debugging your application from main.ts, use Run -> Debug main. This means that VSCode will run your main.ts file and suspend execution if it hits a breakpoint or debugger statement. To debug your tests, use Run -> Debug tests.

If you are not familiar with how to use a debugger, then watching some of these videos may help: