Adding a succeeding failure unit-test to a custom task fail Azure DevOps pipeline
See original GitHub issueEnvironment
azure-pipelines-task-lib version: 2.9.3
Issue Description
I’m trying to build a very simple task that compute a valid version number based upon the current date/time.
I’m following the instructions on the Add a build or release task page and am trying to run unit-tests from an Azure DevOps pipeline.
Obviously, because there is failure test, I’m getting the failed output of the task in the failure test, like so:
However, because this is a custom DevOps task, it includes the #vso[task.issue type=error;]
pattern as part of the failing test output. That pattern fails the Azure DevOps build:
Actual behaviour
Is there a way to prevent the task from emitting output during unit-testing. I probably could do it by supplying a custom input and change the code of my tasks but I wanted to know if there was a solution you had in mind.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
I discovered my issue. You need to make sure you call
mocha
with the path to thesuite.js
. If you justcd
in to the test directory and callmocha
, it will spit out all of the##vso
lines.@springcomp , you appear to be correctly calling
mocha
with the path to thesuite.js
, but you have an assertion error.Going back to this issue now, I can confirm this is still not solved. Would be great to have official guidance for running failure unit tests in Azure DevOps.