无效的配置文件(Cypress 10.0)-找不到模块

问题描述 投票:0回答:2

我正在尝试将我的 Cypress configFile 转换为与 Cypress 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 社区的其他人可以帮助我。预先感谢!

javascript cypress
2个回答
4
投票

我设法解决了这个问题。

在运行

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

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

0
投票

试试这个:npm install cypress --save-dev --force

© www.soinside.com 2019 - 2024. All rights reserved.