我试图在Cypress 10.3中实现一些自定义命令,这些命令可以在不同的测试用例中作为全局命令使用,或者在不同的文件中使用。
我在支持文件夹中创建了一个functions.ts文件,并在其中定义了一个自定义命令,并将其导入到e2e.ts文件中,但是当我想在另一个文件中使用该函数时,我会得到一个错误,即cy.getBody is not a function。
我还试图将该函数定义为接口,但我不知道如何实现该函数作为全局命令。
cypress/support/commands.ts
declare global {
namespace Cypress {
interface Cha
我有以下存储库结构:
cypress文件夹
.eslintrc.jstsconfig.jsonbasic.spec.ts
src文件夹
.eslintrc.js
tsconfig.base.json
tsconfig.json
我的目的是只为src文件夹设置根src,.eslintrc.js也是如此。然后,我尝试为tsconfig.json文件夹配置.eslintrc.js和cypress文件夹。但是,在运行ESLint时会出现以下错误:
Parsing error: "parserOptions.project" has been set for @typescript-es
我有一个项目与React,,Typescript(输出为es5)。
当我使用或运行cypress时,它会出现以下问题:
TypeScript error: cypress/integration/Google/google.ts(5,3): Error TS2304: Cannot find name 'cy'.
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
如果我删除React父文件夹中的tsconfig.json,它修
我有以下用于柏树的插件文件:frontend/cypress/plugins/index.ts
export default ((on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}) as Cypress.PluginConfig
当我在我的机器上运行它时,它是工作的,但是当我在github操作中使用cypress-io/github-action@v2时,我会得到以下错误:
Your plug
我收到的错误消息是:
File 'd:/Project/server/jest.config.ts' is not under 'rootDir'
'd:/Project/server/src'. 'rootDir' is expected to contain all source files.
The file is in the program because:
Matched by include pattern '**/*' in 'd:/Project/server/tsconfig.json
我不确定为什么会出现这个错误
You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project"
这是我的配置
tsconfig
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom
我的解决方案项目中有子模块。这两个项目(第一个、第二个项目)都有.ts文件,所以我想将tsconfig.json放在子模块中,并为它们共享它。 在文件系统中,它们的位置如下: ~/solution
--project1
--Scripts
--(ts files)
--submodule
--tsconfig.json(I want to put it here)
~/solution
--project2
--Scripts
--(ts files)
--submodule
project1's name is equal with project2
我在使用Cypress版本4.2.0的Angular 8项目中,在尝试导入.ts文件时遇到以下错误
/.../cypress/integration/main.spec.ts:1
import { MOCK1, MOCK2, MOCK3 } from '../fixtures/mocks/index';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
我的tsconfig.json
{
"compilerOp