gpt4 book ai didi

testing - CircleCI + Cypress 配置

转载 作者:行者123 更新时间:2023-11-28 19:57:47 28 4
gpt4 key购买 nike

您好,我在与 Cypress 一起设置 CircleCi 时遇到问题。

我将 docker 镜像包含在所有必要的依赖项中,但它仍然无法正常工作。我尝试了大约 40 种不同的配置,但没有任何积极的结果。请检查我在下面的屏幕截图中附加的配置和输出。

enter image description here

version: 2
jobs:
build:
docker:
- image: circleci/node:9.2.0

- image: circleci/mongo:3.4.4
- image: cypress/base:8

working_directory: ~/repo

steps:
- checkout

- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-

- run: yarn install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- run: yarn test // THIS COMMAND RUNS UNIT TESTS - and it is working ok

- run: yarn run dev & $(npm bin)/cypress run // THIS ONE IS FAILING

我还意识到,如果我删除 node/mongo 的图像并仅运行 e2e 测试,它就可以正常工作。当我尝试使用三个 docker 图像同时运行单元和 e2e 测试时出现问题。

最佳答案

我试过了 bkcura's answer但它没有用,同样的错误仍然出现。

所以我尝试使用新的 Circle 功能(orbs)来混合两个 orbs:

它有效 🎉

这是我的config.yml:

version: 2.1
orbs:
cypress: cypress-io/cypress@1
react: thefrontside/react@0.1.0
workflows:
push:
jobs:
- react/install
- react/test:
requires:
- react/install
build:
jobs:
- cypress/run:
yarn: true
start: yarn start
wait-on: 'http://localhost:3000'
no-workspace: true

带演示的 repo :https://github.com/jeanbauer/create-react-app-cypress-circle-ci

注意:这可能效率不高,所以如果您看到任何改进,请给我一个问题 here

关于testing - CircleCI + Cypress 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50222410/

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