【发布时间】:2020-02-05 17:18:23
【问题描述】:
Jenkins/jest 和 CI,
我使用 create-react-app 创建了一个 React APP,我使用 JEST 进行测试,我在创建 app.test.js 并提交到 git-hub 的文件中做了一些新的更改——用 jenkins 钩住它——当我在本地机器上运行 npm test 测试运行良好并且它们都通过了.. 但是当我运行 jenkins 管道脚本时,它会显示以下内容:
No tests found related to files changed since last commit.
Press a to run all tests, or run Jest with --watchAll.
Watch Usage
› Press a to run all tests.
› Press p to filter by a filename regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
我已尝试更改 app.test.js - 创建了一个新文件提交更改,然后在 jenkins 中创建了一个新管道并再次尝试(我也尝试过这里讨论的这些:https://github.com/facebookincubator/create-react-app/issues/930)但我仍然收到上述错误:我的管道脚本如下所示:
node{
stage "CI"
git 'https://github.com/NaveenDK/mentalshortcuts.git'
bat "npm install"
stage " Unit testing"
bat "npm test"
}
def notify(status){
emailext (
to: "dd@dd.com",
subject: "${status}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>${status}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at <a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a></p>""",
)
}
node {
notify("Deploy to staging?")
}
input 'Deploy to Staging?'
node {
bat "npm run-script build"
}
任何帮助任何链接任何东西都会很棒!
【问题讨论】:
-
大家好,我已经用一个从头开发的新应用程序尝试了 npm test 命令,但问题仍然存在......
标签: reactjs jenkins jenkins-pipeline jestjs