执行赛普拉斯测试时引用错误“进程未定义”

las*_*eep 5 testing cypress

尝试执行任何测试都会导致出现此错误。

我正在使用赛普拉斯 6.5.0

真的不知道该怎么办。

对不起,图像,但以这种方式显示它要好得多。

在此处输入图片说明

还有 StackTrace。

at Object../node_modules/is-ci/node_modules/ci-info/index.js (webpack:///node_modules/is-ci/node_modules/ci-info/index.js:5:1)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object../node_modules/is-ci/index.js (webpack:///node_modules/is-ci/index.js:3:18)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object.eval (webpack:///node_modules/cypress/lib/util.js:21:14)
at Object../node_modules/cypress/lib/util.js (http://localhost:37869/__cypress/tests?p=test/e2e/support/index.js:87250:31)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object.eval (webpack:///node_modules/cypress/index.js:9:14)
at Object../node_modules/cypress/index.js (http://localhost:37869/__cypress/tests?p=test/e2e/support/index.js:82972:31)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
From previous event:
at runScriptsFromUrls (http://localhost:37869/__cypress/runner/cypress_runner.js:177985:98)
at Object.runScripts (http://localhost:37869/__cypress/runner/cypress_runner.js:177999:11)
at $Cypress.onSpecWindow (http://localhost:37869/__cypress/runner/cypress_runner.js:167733:19)
Run Code Online (Sandbox Code Playgroud)

Chr*_*ter 8

当我在测试中导入柏树时,这发生在我身上,删除它解决了问题

  • 我确认在测试文件中导入 cypress 会导致错误,对我来说,是 eslint 抱怨未定义的 `describe`、`it` 和 `cy`,我通过添加 `import { cy, describe, it } from " 来修复此问题cypress";`,但是这一行导致了错误。无论如何,要抑制 cypress 的 eslint 错误,请按照以下说明操作 /sf/answers/4638760941/ (2认同)

can*_*bax 6

有时,Visual Studio Code 会错误地自动导入不必要的库。你应该删除它们。对我来说是

import { cli } from 'cypress';