如何使用NX将E2E测试添加到现有存储库中?
在教程视频中,我可以看到,当他创建一个新项目时,NX还为E2E测试用例创建了同级储备。
https://nx.dev/reaect.dev/react-tutorial/01-create-create-create-application
我的问题是,我有一个已经创建的MonorePo,它具有这样的结构。前端是使用npx-create-react-app ...
MyApp
- FrontEndRepo
- BackEndRepo
根据nx公约 nrwl nx为什么要为每个应用程序创建一个单独的E2E项目?
如果我开始使用它创建我的项目,则应该是这样的。
MyApp
- FrontEndRepo
- FrontEndRepo-e2e
- BackEndRepo
- BackEndRepo-e2e
那么,如何将这些E2E测试文件夹添加到现有存储库中呢?
In the tutorial video, I can see that when he created a new project NX also create a sibling repo for e2e test cases.
https://nx.dev/react-tutorial/01-create-application
My question is that I got a monorepo which I already created, which have a structure like this. front end was created with npx-create-react-app ...
MyApp
- FrontEndRepo
- BackEndRepo
According to NX convention Why does nrwl nx create a separate e2e project for each app?
If I start creating my project with it should be something like this.
MyApp
- FrontEndRepo
- FrontEndRepo-e2e
- BackEndRepo
- BackEndRepo-e2e
So how can I add those e2e test folders to existing repo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的是只需在每个
-e2e
文件夹中创建一个项目结构,然后在两个地方安装柏树。要从根部运行前端或后端测试,请在
package.json
中添加两个脚本,更改每个脚本。cypress.config.js
在每个-e2e
文件夹中是特定于该项目要求的,例如API URL等。The simplest is to just create a project structure in each
-e2e
folder and install Cypress in both places.To run front-end or back-end tests from the root, add two scripts in
package.json
, changing the config file reference in each one.The
cypress.config.js
in each-e2e
folder is specific to the requirements of that project, e.g API url etc.使用nx为您生成它:
npx nx generate @nrwl/cypress:cypress-project frontEndRepo-e2e -project = frontendEndRepo
Use Nx to generate it for you:
npx nx generate @nrwl/cypress:cypress-project FrontEndRepo-e2e --project=FrontEndRepo