【问题标题】:Is it possible to place Cypress tests in existing React file architecture是否可以将 Cypress 测试放在现有的 React 文件架构中
【发布时间】:2020-01-07 22:42:26
【问题描述】:

我知道他们的模式表明将所有赛普拉斯测试/集成放在 cypress/integration 路径中。但是,我想将测试放在src/components 路径中。

src
 └── components
      └── Component1Directory
            ├── Component1.js
            └── tests 
                └── cypress_integration_for_component_1.js

      └───Component2Directory
            ├── Component2.js
            └── tests 
                └── cypress_integration_for_component_2.js

我已尝试更改配置,但通配符似乎不起作用。

{
  "baseUrl": "http://localhost:4001",
  "integrationFolder": "src/components/*/tests"
}

我还尝试使用通配符代替“测试”来删除测试子目录,但这也不起作用。

【问题讨论】:

    标签: reactjs config cypress


    【解决方案1】:

    我将文件名更新为

    *.cy.js
    

    并将配置更新为

    {
      "baseUrl": "http://localhost:4001",
      "integrationFolder": "src/",
      "testFiles": "**/*.cy.js"
    }
    

    这允许在现有文件结构中找到测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-14
      • 2022-11-11
      • 2019-08-17
      • 2015-03-07
      • 2012-10-07
      • 1970-01-01
      • 2019-09-08
      • 2023-01-30
      相关资源
      最近更新 更多