您如何获得“反式脚本测试”与AWS Codepipeline合作?

发布于 2025-02-06 07:14:52 字数 426 浏览 3 评论 0原文

我有一个使用Create React应用程序生成的React应用程序。我想在AWS Codepipeline启动之前确保测试通过。这是我的buildspec.yml文件,没有npm test命令正常工作。添加测试命令后,它将运行测试,我已经设置了要失败的测试,然后构建就挂起。

version: 0.2

phases:
  install:
    commands:
      - cd react/menu && npm install
  build:
    commands:
      - npm test
      - npm run-script build

artifacts:
  files: "**/*"
  base-directory: "react/menu/build"

I have a React app that I generated using Create React App. I'd like to make sure the tests pass before the build starts in AWS CodePipeline. Here is my buildspec.yml file which works just fine without the npm test command. Once I add the test command, it runs the tests, which I have setup to fail, and then the build just hangs.

version: 0.2

phases:
  install:
    commands:
      - cd react/menu && npm install
  build:
    commands:
      - npm test
      - npm run-script build

artifacts:
  files: "**/*"
  base-directory: "react/menu/build"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情域 2025-02-13 07:14:53

按照 @Haseeb-Anwar建议,我能够通过关闭手表模式来使其工作。

version: 0.2

phases:
  install:
    commands:
      - cd react/menu && npm install
  build:
    commands:
      - npm test -- --watchAll=false
      - npm run-script build

artifacts:
  files: "**/*"
  base-directory: "react/menu/build"

I was able to get it to work by turning off watch mode as @haseeb-anwar suggested.

version: 0.2

phases:
  install:
    commands:
      - cd react/menu && npm install
  build:
    commands:
      - npm test -- --watchAll=false
      - npm run-script build

artifacts:
  files: "**/*"
  base-directory: "react/menu/build"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文