Azure Dev Ops react-scripts test hangs forever

只愿长相守 提交于 2020-07-20 10:50:10

问题


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'

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!


回答1:


Update the script like this:

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


来源:https://stackoverflow.com/questions/57047477/azure-dev-ops-react-scripts-test-hangs-forever

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!