azure-pipelines-tasks: Npm V1 task does not write proper output to logs

In my build pipeline I use Npm v1 task to run npm test and npm install commands. In the log output from the task I can see only a single line like:

 [command]C:\Windows\system32\cmd.exe /D /S /C "C:\BuildAgents\A\_work\_tool\node\8.11.1\x64\npm.cmd install --no-optional"

This is not sufficient for my needs I would like to see detiled logs - just exactly the logs that I can see when I start npm via cmd.exe on my local machine. I use VSTS with the “new” visual theme.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 17 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@elangelo can we have an update on this issue?

@elangelo Any update on this? I’m struggling with timeouts on long-running npm test task and cannot see the culprit due to missing logs

@elbatk, is there any estimate or issue that can be tracked for this redesign?

The NPM task synchronously runs your command, buffers the output, and prints it at the end of the task. We will be switching to async (i.e. streaming STDOUT/STDERR) but there should be no change in total duration of your step. The only difference will be that you observe STDOUT/STDERR sooner.

OK I double checked (in meanwhile we have an update to VSTS) and now we indeed get log output on completed builds. But still output is missing on ongoing builds. Now I must wait 10 minutes until command is finished and only then I can see log output - no immediate results.

image

Please see attached screenshot - I entered the build log after command run for 4 minutes still without any output.

@kepikoi

elangelo Any update on this? I’m struggling with timeouts on long-running npm test task and cannot see the culprit due to missing logs

Try use a different task type instead, we do something like the following and it then shows output:

- task: CmdLine@2
  condition: succeeded()
  inputs:
    script: npm test
    workingDirectory: $(workingDirectory)

@keithrob, @bryanmacfarlane: The current behavior of the npm task buffering output is also a problem for us. We need to enable realtime output from long-running tests. For now, we will workaround this by using a script task instead of npm.

Hello! I’m a PM over on the Azure Artifacts team. I wanted to drop in here and address some of these issues with the news that we’re currently reevaluating the types of tasks we offer in Azure Pipelines, and looking to focus more on lighter-weight tasks that cover authentication and setup. In lieu of the task redesign, we’re going to forego making changes to the current tasks (with a few exceptions). We hope the new tasks we spin up in the next quarter or so are easier and more helpful, be on the lookout!

An addition to my copied/pasted blurb above: The issue seen here is one of the reasons we’re switching - to remove some of our unwanted/unexpected behavior in favor of simply using the scripts/command line tools from the actual protocols.