-
Notifications
You must be signed in to change notification settings - Fork 25
Local Development
This article will guide you through debugging the extension on your local machine and talk you through all prerequisite steps required to get the extension running on your local machine.
Please make sure all commands are ran from a Git Bash terminal.
Before you can dive in and begin debugging the extension there are a hand-full of tasks required to configure your local developer environment.
- Clone the repository to your local machine.
- Edit
INPUT_PATH
in all theconfig/*.env
files to point to your working directory. - Ensure the
tasks.json
andlaunch.json
configurations below exist in their respective files within the.vscode
directory. - Ensure the TFS CLI is installed by running
npm install -g tfx-cli
- Install all required npm modules by running
npm run-script initdev
Now that all the modules have been installed and our environment is configured we can begin debugging by:
- Open the project with Visual Studio Code.
- Clicking
Debug (Ctrl+Shift+D)
in the explorer view. - Selecting either
Launch .Net Framework
orLaunch .Net Core
. - Clicking the
Start Debugging
button.
Task parameters are defined within the .env
files found within the /config
directory at the root of the repository.
See the VS Code repository for additional launch recipes:
https://github.com/Microsoft/vscode-recipes/tree/master/debugging-mocha-tests
I'm slowly adding a suite of unit tests to the extension to ensure no breaking changes are added as we move forward with the development of the extension. I'm hoping this area of the wiki will grow overtime but for now here are the small number of steps to execute the unit tests:
There are a handful of unit tests written for the .Net Core task. To run the tests execute the following npm command npm run-script test
. This command is found in the package.json
and will build the application and run the test suite.
Please note: - On first execution you will see the unit test "should succeed and print input task parameters" fail as this unit test is checking an absolute path. Please amend the path in the test and alter the path in the ./src/netcore/tests/builders/request-model-builder.ts
model builder file.
I know I need to come up with a better solution to this 🙈
To debug the unit tests:
- From Visual Studio Code click
Debug (Ctrl+Shift+D)
in the explorer view. - Selecting either
Mocha .Net Core
. - Clicking the
Start Debugging
button.
There are currently no unit tests for the .Net Framework task but this is something I'm hoping to address in the near future.
You can run the tasks by issuing one of the following commands. All output will be logged to the terminal window:
-
app:netframework
to run the .Net Framework task -
app:netcore
to run the .Net Core task
Ensure the following configuration is added to your tasks.json
file:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build TypeScript",
"command": "tsc",
"type": "shell",
"args": [
"-p",
"."
],
"presentation": {
"reveal": "never"
},
"problemMatcher": "$tsc"
},
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
]
}
]
}
Ensure the following configuration is added to your launch.json
file:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch .Net Framework",
"protocol": "inspector",
"envFile": "${workspaceFolder}/config/netframework.env",
"args": [ "./src/netframework/index.ts" ],
"cwd": "${workspaceRoot}",
"runtimeArgs": [ "-r", "ts-node/register" ],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Mocha .Net Framework",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--require", "ts-node/register",
"--timeout", "999999",
"--colors", "--recursive",
"${workspaceFolder}\\src\\netframework\\tests\\index.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
},
{
"type": "node",
"request": "launch",
"name": "Launch .Net Core",
"protocol": "inspector",
"envFile": "${workspaceFolder}/config/netcore.env",
"args": [ "./src/netcore/index.ts" ],
"cwd": "${workspaceRoot}",
"runtimeArgs": [ "-r", "ts-node/register" ],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Mocha .Net Core",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--require", "ts-node/register",
"--timeout", "999999",
"--colors", "--recursive",
"${workspaceFolder}\\src\\netcore\\tests\\_suite.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
}
]
}