cronvel / terminal-kit

Terminal utilities for node.js
MIT License
3.08k stars 198 forks source link

term.table does not work in Azure pipeline #241

Closed guyappy closed 11 months ago

guyappy commented 11 months ago

copy of #240 since that one was closed(I think prematurely)

I'm running the following command in an Azure DevOps pipeline:

        - task: PowerShell@2
          displayName: 'Linting OpenAPI specification'
          continueOnError: true
          inputs:
            targetType: 'inline'
            workingDirectory: TEAM-spectral-linter
            script: |
              Write-Host "Starting OpenAPI linter"
              node index.js --mode=file
            failOnStderr: false
This triggers the index.js to print the following table eventually which works fine on my local (Windows) machine:

input;

const rows = [["Severity","Code","Message","Path","Range from","Range to"],["warn","operation-description","Operation \"description\" must be present and non-empty string.","paths->/external/suniverse/v1/products->get","27:13","112:7"],["hint","recognize-mandatory-query-param","Check if the query parameter 'type' is really required.","paths->/external/suniverse/v1/products->get","27:13","112:7"],["hint","operation-tag-defined","Operation tags must be defined in global tags.","paths->/external/suniverse/v1/products->get->tags->0","29:10","29:20"],["error","error-response","Error response body must be an errors array with at least one of the following properties: \"status\", \"title\", \"detail\", \"id\", \"links\", \"about\", \"type\", \"source\", \"meta\" or \"code\". See https://eneco.sharepoint.com/sites/EnablingPlatforms-ST/SitePages/API_Conventions_Errors.aspx for more details about the errors object.","paths->/external/suniverse/v1/products->get->responses","50:21","111:9"],["hint","security-definition-description","It would be more descriptive if you provide a description for every security definition.","components->securitySchemes->apiKey","132:16","136:7"],["warn","oas3-unused-component","Potentially unused component has been detected.","components->responses->401Error","150:18","164:7"],["error","verify-top-level-members","Response contains invalid top level member: message. For more info see: https://eneco.sharepoint.com/sites/EnablingPlatforms-ST/SitePages/API_Conventions_Document_Structure.aspx#top-level","components->responses->Products422Error->content->application/json->schema->properties","170:28","185:15"]];
term.table( rows , {
    hasBorder: true ,
    contentHasMarkup: true ,
    borderChars: 'lightRounded' ,
    borderAttr: { color: 'blue' } ,
    // textAttr: { bgColor: 'default' } ,
    // firstCellTextAttr: { bgColor: 'blue' } ,
    firstRowTextAttr: { bgColor: 'blue',  } ,
    // firstColumnTextAttr: { bgColor: 'red' } ,
    width: 160
});

image

However, in the Azure DevOps pipeine it does not show anything in the logs. The rows.length result in shown in the below screenshot and I copied the output (the array) and put that above in the code block which works locally. image

I later added the console.table command to check whether there is an issue with stdout;

      console.log(`rows length: ${rows.length}`)
      console.log(`rows: ${JSON.stringify(rows)}`)
      console.table(rows);
      term.table( rows , {
              hasBorder: true ,
              contentHasMarkup: true ,
              borderChars: 'lightRounded' ,
              borderAttr: { color: 'blue' } ,
              // textAttr: { bgColor: 'default' } ,
              // firstCellTextAttr: { bgColor: 'blue' } ,
              firstRowTextAttr: { bgColor: 'blue',  } ,
              // firstColumnTextAttr: { bgColor: 'red' } ,
              width: 160
      });

output on Azure is the normal table but no table from terminal: image

Any help is greatly appreciated

cronvel commented 11 months ago

Hi,

When an issue is closed, immediately recreating the same issue is not a correct behavior.

Duplicating an issue just creates noises and consumes times. I had already planned to check for potential bugs.

I hope that you will understand and keep this issue tracker clean.