gpt4 book ai didi

azure - 等待 azure 管道中的控制台输出

转载 作者:行者123 更新时间:2023-12-02 08:33:05 25 4
gpt4 key购买 nike

我正在尝试在我的 azure 管道中运行一些单元测试,但它一直显示“等待控制台输出”。这持续了大约一个小时,直到最终失败。我不明白为什么它无法访问控制台的输出。一般而言,对于使用 Azure/管道是新手,如有任何帮助,我们将不胜感激。谢谢。

Error message

这是我的 yaml 文件:

pr:
- $(branch)

pool:
vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.14'
displayName: 'Install Node.js'

- script: |
npm install -g @angular/cli
npm install
displayName: 'Install Angular Dependencies'

- task: Npm@1
displayName: 'Lint Angular'
inputs:
command: custom
customCommand: run lint -- --format=stylish

- script: |
npm run test
displayName: 'Run Unit Tests'

- task: PublishTestResults@2
displayName: 'Publish unit tests results'
condition: succeededOrFailed()
inputs:
searchFolder: $(System.DefaultWorkingDirectory)/src/tests/junit
testRunTitle: Angular
testRunner: JUnit
testResultsFiles: "**/TESTS-*.xml"

- task: PublishCodeCoverageResults@1
displayName: 'Publish unit test code coverage results'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/src/tests/coverage/cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/src/tests/coverage
failIfCoverageEmpty: true

- script: |
$(npm-script)
displayName: 'Build App'

- script: |
cd $(System.DefaultWorkingDirectory)/
ls -a
cp -r dist $(Build.ArtifactStagingDirectory)/
cp ecosystem.config.js $(Build.ArtifactStagingDirectory)/
cd $(Build.ArtifactStagingDirectory)/
ls -a
# rm -r node_modules
# ls -a
displayName: 'Copy Files to Archive'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' # '$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true

- script: |
cd $(System.DefaultWorkingDirectory)/
ls -a
cd $(Build.ArtifactStagingDirectory)/
ls -a
displayName: 'Check Files 2'

- task: CopyFiles@2
displayName: 'Copy File to: $(TargetFolder)'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)/'
Contents: '$(Build.ArtifactStagingDirectory)/**/*.zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)/ArtifactsToBePublished'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: App'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/ArtifactsToBePublished'

# - script: |
# npm run pre-e2e
# npm run e2e
# displayName: 'Run E2E Tests'

- script: |
pwd
cd $(Build.ArtifactStagingDirectory)/ArtifactsToBePublished
ls -a
displayName: 'See Content'

最佳答案

我可以使用 npm run test 脚本重现相同的问题。您可以尝试使用 Npm 任务运行单元测试,而不是使用脚本任务。

- task: Npm@1
displayName: 'Unit Test'
inputs:
command: custom
customCommand: run test -- --watch=false --code-coverage

或者

- task: Npm@1
displayName: 'Test e2e Angular'
inputs:
command: custom
customCommand: run e2e

关于azure - 等待 azure 管道中的控制台输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59074698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com