question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mock Test Runner fails to download a new NodeJS distribution

See original GitHub issue

Please check our current Issues to see if someone already reported this https://github.com/Microsoft/azure-pipelines-task-lib/issues

Environment

azure-pipelines-task-lib version: 2.9.3

Issue Description

While executing unit tests, when calling MockTestRunner.run() a binary distribution of NodeJS is being downloaded. While running on a ubuntu-latest agent, the download fails without any information error.

Expected behaviour

The NodeJS binary is downloaded successfully. The test runs.

Actual behaviour

An error is thrown during the test with the following message:

      Downloading file: https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz

Steps to reproduce

  1. Clone https://github.com/codexarcana/azure-tasks
  2. Create an azure pipeline with the following code:
        npm install
        npm run test
    

Logs

FAIL tests/integration.test.ts
  ● Console

    console.log
      Downloading file: https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz

      at MockTestRunner.downloadFile (node_modules/azure-pipelines-task-lib/mock-test.js:228:17)

  ● should succeed with simple inputs



       6 | 
       7 |     const testPath = path.join(__dirname, 'success.integration.js');
    >  8 |     const testMockRunner = new MockTestRunner(testPath);
         |                            ^
       9 | 
      10 |     testMockRunner.run(10);
      11 | 

      at doRequest (node_modules/sync-request/index.js:27:11)
      at MockTestRunner.downloadFile (node_modules/azure-pipelines-task-lib/mock-test.js:230:22)
      at MockTestRunner.downloadTarGz (node_modules/azure-pipelines-task-lib/mock-test.js:242:14)
      at MockTestRunner.downloadNode (node_modules/azure-pipelines-task-lib/mock-test.js:206:22)
      at MockTestRunner.getNodePath (node_modules/azure-pipelines-task-lib/mock-test.js:147:25)
      at new MockTestRunner (node_modules/azure-pipelines-task-lib/mock-test.js:28:30)
      at tests/integration.test.ts:8:28
      at step (tests/integration.test.ts:33:23)
      at Object.next (tests/integration.test.ts:14:53)
      at tests/integration.test.ts:8:71

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
MalinAancommented, Aug 17, 2020

I’m facing the same issue as well (using node v12.4.0 and azure-pipelines-task-lib 2.10.0). It seems like the problem is the buffer size to sync-request.

I had to change line 25 in sync-request/index.js to include max buffer size to make it work. var res = spawnSync(process.execPath, [require.resolve('./lib/worker.js')], {input: req, maxBuffer: 50 * 1024 * 1024});

4reactions
knomcommented, Jun 20, 2020

I’m using azure-pipelines-task-lib version: 2.9.5 in Azure DevOps - Node 10

The error mentioned above comes up on Ubuntu 18 as well as Windows…

When will this be fixed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSTest@2 - Visual Studio Test v2 task - Microsoft Learn
Use this task to run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VSTest) runner.
Read more >
Mocking modular AWS SDK for JavaScript (v3) in Unit Tests
For the AWS SDK for JavaScript (v2), you can use the aws-sdk-mock library for unit test mocks. It is built by the community...
Read more >
Getting Started with Node.js and Mocha - Semaphore Tutorial
Mocha is a simple, extensible and fast testing library for Node.js. This article will walk you through its installation, configuration and usage.
Read more >
Node.js v19.3.0 Documentation
new StringDecoder([encoding]); stringDecoder.end([buffer]); stringDecoder.write(buffer). Test runner. Subtests; Skipping tests; describe / it syntax ...
Read more >
How To Set Up a Node.js Application for Production on ...
Though you can run Node.js applications at the command line, this tutorial will focus on running them as a service. This means that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found