if you have followed Microsoft’s “Add a custom pipelines task extension” it does a great Job on giving you the basics of how you can create a new NodeJS custom pipelines task, and it gives a very good starting point for your custom pipelines task. it even comes with mocha tests with, “azure-pipelines-task-lib/mock-test” which help you to mock how task will run as a task.
if you are using any library which their js files uses async await, or some of the new Node capabilities you may get
async {merthod name}(request) {
^^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
if you have this problem
task.json file:
{
"$schema": "https://raw.githubusercontent.com/Microsoft/azure-pipelines-task-lib/master/tasks.schema.json",
"id": "{{taskguid}}",
"name": "{{taskname}}",
"friendlyName": "{{taskfriendlyname}}",
"description": "{{taskdescription}}",
"helpMarkDown": "",
"category": "Utility",
"author": "{{taskauthor}}",
"version": {
"Major": 0,
"Minor": 1,
"Patch": 0
},
"instanceNameFormat": "Echo $(samplestring)",
"inputs": [
{
"name": "samplestring",
"type": "string",
"label": "Sample String",
"defaultValue": "",
"required": true,
"helpMarkDown": "A sample string"
}
],
"execution": {
"Node": {
"target": "index.js"
}
}
}
Update execution.Node to Node10 or Node16 in task.json like
"execution": {
"Node10": {
"target": "index.js",
"argumentFormat": ""
},
"Node16": {
""target": "index.js",
"argumentFormat": ""
}
This will allow you to use Node10 or Node16 Functionalities in your task