【问题标题】:Invalid configFile (Cypress 10.0) - cannot find module无效的配置文件 (Cypress 10.0) - 找不到模块
【发布时间】:2022-06-15 23:27:57
【问题描述】:

我正在尝试将我的赛普拉斯配置文件转换为与赛普拉斯 10.0+ 一起使用

我已遵循新文档,但赛普拉斯声明我的文件无效。

“错误:找不到模块'cypress'”

这是我尝试使用的配置...

const { defineConfig } = require('cypress')

module.exports = defineConfig({
    e2e: {
        specPattern: "tests/e2e/**/*.cy.js",
        supportFile: "tests/support/e2e.js"
    },
    projectId: "zpk6q6",
    reporter: "junit",
    reporterOptions: {
        mochaFile: "tests/test-output-[hash].xml",
        toConsole: true,
        attachments: true
    }
})

希望赛普拉斯社区的其他人可以帮助我。提前致谢!

【问题讨论】:

  • 您是否使用直接下载获得Cypress?如果是这样,请尝试将 module.exports = defineConfig({ 替换为 module.exports = { 并删除 require(此处的信息:github.com/cypress-io/cypress/issues/21999

标签: javascript cypress


【解决方案1】:

我设法解决了这个问题。

在运行 npx cypress run... 之前,我需要实际安装 Cypress。所以我的命令看起来像

npm install cypress --save-dev
npx cypress run --browser chrome

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-12
    • 2022-08-04
    • 1970-01-01
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    相关资源
    最近更新 更多