Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Can';t在Cypress cucumber typescript中没有用于React的tsconfig.json_Reactjs_Typescript_Cucumber_Cypress - Fatal编程技术网

Reactjs Can';t在Cypress cucumber typescript中没有用于React的tsconfig.json

Reactjs Can';t在Cypress cucumber typescript中没有用于React的tsconfig.json,reactjs,typescript,cucumber,cypress,Reactjs,Typescript,Cucumber,Cypress,我有一个带有React、Typescript(在es5中输出)的项目。 当我使用or运行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父

我有一个带有React、Typescript(在es5中输出)的项目。
当我使用or运行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
,它修复了
语法错误
,但仍然存在
TypeScript错误

因此,似乎是
tsconfig.json
造成了这个问题,但是项目不应该没有
tsconfig.json

这是我的
tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}

错误TS2304:找不到名称“cy”

您应该在文件顶部添加:


//

你能发布你的
tsconfig
吗?@Brendan是的,我发布了。我怀疑这是因为你在
tsconfig
中只包含
src
,所以你的测试不包括在内。尝试更改为:
“include”:[“src”,“cypress”]
@Brendan它仍然存在与错误TS2304相同的问题:找不到名称“cy”。