Authoring Azure DevOps Task — Development Environment (2)

Debugging with VSCode


What I want to achieve

  • Run Unit Test with Coverage
  • Generate JUnit and Coverage report
  • Debugging
  • Package and publish your extension
  • CI / CD

Unit Test, Coverage, and Report

"scripts": {
"compile": "tsc -p .",
"deploy": "Script\\deploy.bat",
"build": "Script\\build.bat",
"test": "tsc -p . & nyc mocha ./Test/L0.js",
"report": "tsc -p . & mocha ./Test/L0.js --reporter mocha-junit-reporter & nyc report"
"nyc": {
"extension": [
"include": [
"reporter": [
"report-dir": "./.coverage_output/coverage",
"all": "true",
"check-coverage": true,
"statements": 70,
"functions": 70,
"branches": 70,
"lines": 70


Enable Source Map with tsconfig.json

“compilerOptions”: {
“target”: “es6”,
“module”: “commonjs”,
“sourceMap”: true


Adding configuration for debugging
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit:
"version": "0.2.0",
"configurations": [
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"preLaunchTask": "Typescipt compile",
"args": [
"internalConsoleOptions": "openOnSessionStart"


// See
// for the documentation about the tasks.json format
“version”: “2.0.0”,
“tasks”: [
“label”: “Typescipt compile”,
“type”: “shell”,
“command”: “tsc -p .”

Package your extension

Upload your task for testing

tfx login -t <<your personal access token>> -u <<your AzureDevOps organization url>>
tfx build tasks upload --task-path <<your task directory>> --auth-type pat --overwrite

Upload extension

call Script\deploy.bat
tfx extension create --manifest-globs vss-extension.json


Azure Pipeline Build configuration

Published artifact
Coverage report

Release pipeline

Release pipeline
Publish Extension
Task Published

Control exposure

"galleryFlags": [    "Public"  ],
"preview": true,

Versioning Strategy

Task version






Senior Software Engineer — Microsoft

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Learning to Code: Day 28 — Grid Part 1

Select a single column of a pandas DataFrame with the brackets and not dot notation

Database and Information Systems Development: Data Dictionaries

Visualizing the Collatz Conjecture with Python

Fantastic Beasts and Where to Find Them (2016)

Making API integration painless

Zaira Rasool — Junior Engineer

Time for a new project | Unity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tsuyoshi Ushio

Tsuyoshi Ushio

Senior Software Engineer — Microsoft

More from Medium

DDD — Entity and Value Types

CQRS in a nutshell

Build a Placeholder API With the New ASP.NET Core Minimal API

Memory Management In .NET

Memory Management In .NET. All about memory management in DotNet (.NET) and important related topics. Stack Heap Variables String Boxing Unboxing Garbage Collection Performance Small Objects Heap (SOH) Memory Generations Large Objects Heap (LOH) Dispose Finalize Managed Unmanaged Leak Finalization Finalizer Design Pattern Code Coding Programming Software Development Architecture Engineering Best Practice Basics CSharp (C#)