Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node version discrepancy between task library docs, tutorial docs, build, and mock task runner #973

Closed
tillig opened this issue Sep 21, 2023 · 3 comments

Comments

@tillig
Copy link

tillig commented Sep 21, 2023

Environment

azure-pipelines-task-lib version: 4.4.0

Issue Description

In the Node documentation in this repo it indicates the task SDK is in the process of updating from Node 6 to Node 10 as the default:

Azure DevOps is currently working to establish Node 10 as the new preferred runtime for tasks, upgrading from Node 6.

The current build for the task library is using Node 16.

variables:
  - group: npm-tokens
  - name: nodeVersion
    value: '16.13.0'

The tutorial documentation on how to build a custom extension using this SDK says that you should use the latest version of Node.

The latest version of Node.js.

This raises some confusion as to which version of Node I should actually be using to build and test my extension.

For example, if I use the MockTestRunner it will currently default to Node 6, which means code I've written in the extension using Node 20 (the "latest version of Node.js" per the tutorial docs) will totally not run in the mock testing scenario.

I see I can tell the MockTestRunner to use Node 16, but if the SDK is only going to work on Node 10 (per the README) then I'm confused as to which version I should use during testing.

The official Azure Pipelines Tasks look like they build with Node 10.

I also can't tell what the version of Node is that will actually end up running my task on the build agent. Can I control that somehow? Is there a default that always gets used? Is it one of the 6 / 10 / 16 versions?

The conflicts between the documentation make it challenging to know what to do here.

Possibly related:

Expected behaviour

I expect consistency across the documentation: build, develop, and test in a specific recommended version or set of versions. I expect instructions explaining how to specify which version your given extension requires if that's an option; or an explanation that it's out of my control and I should look at [insert some link] for the version that is currently in use.

Actual behaviour

Unit tests in Mocha pass but running with the MockTestRunner causes odd Node compatibility errors at runtime like this because it's defaulting to Node 6:

"Error: Cannot find module 'fs/promises'
    at Function.Module._resolveFilename (module.js:476:15)
    at Module._load (module.js:424:25)
    at Function.hookedLoader [as _load] (/Users/tillig/my-task/MyTask/node_modules/mockery/mockery.js:111:12)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/tillig/tillig/my-task/MyTask/SomeFolder/FileReader.js:36:25)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)"

Steps to reproduce

See:

Logs

N/A

Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Dec 27, 2023
@tillig
Copy link
Author

tillig commented Dec 27, 2023

Still an issue.

@github-actions github-actions bot removed the stale label Dec 27, 2023
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants