Azure Dev Ops react-scripts测试永久挂起 [英] Azure Dev Ops react-scripts test hangs forever

查看:59
本文介绍了Azure Dev Ops react-scripts测试永久挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Azure Dev Ops中运行我的应用程序的测试,我不知道如何在测试运行后停止执行.它只是挂在那儿,使管道永远处于运行模式.这是一个简单的create-react-app应用程序,其中包含一些测试.以下是我管道的YAML:

I'm trying to run my react app's tests in Azure Dev Ops I can't figure out how to make the execution stop after the tests run. It just hangs there, holding the pipeline in running mode forever. It's a simple create-react-app application which has a couple of tests. Below is my pipeline's YAML:

trigger: none

pool:
  vmImage: 'ubuntu-latest'

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

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'

- script: npm run citest

- task: PublishPipelineArtifact@0
  inputs:
    artifactName: 'react'
    targetPath: './build'

在测试步骤中我只有-脚本:npm测试",但按照说明在Facebook github 中,我创建了一个新的测试脚本(称为citest):set CI=true && react-scripts test a,但仍然无法正常工作.我在dev ops控制台中获得以下输出,并且该任务一直持续运行:

I had just "- script: npm test" on the test step but, following instructions in the facebook github I created a new test script (called citest): set CI=true && react-scripts test a but it still does not work. I get the below output in the dev ops console and the task just keeps running forever:

> set CI=true && react-scripts test a
PASS src/components/landing/landing.test.js (6.008s)
PASS src/components/navbar/NavBar.test.js
PASS src/components/app/App.test.js
Test Suites: 3 passed, 3 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        7.573s
Ran all test suites matching /a/i.

我已经没有足够的尝试方法了,感谢您的帮助!

I've run out of ideas on what to try - any help is appreciated!

推荐答案

像这样更新脚本:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "citest":"CI=true react-scripts test"
  },

这篇关于Azure Dev Ops react-scripts测试永久挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆