【发布时间】:2019-04-07 00:47:53
【问题描述】:
我正在尝试使用 Jest 来帮助在 WebStorm 中进行 Puppeteer 测试。
这是我第一次使用 Jest,它看起来只是我需要帮助进行测试、断言、设置和拆卸等的框架......
问题是,WebStorm 无法识别关键字,例如beforeAll,描述,毕竟。这是一个sn-p:
我的 package.json 文件如下所示:
{
"name": "ui-tests",
"version": "1.0.0",
"description": "End-to-end UI tests",
"author": "John Doe",
"license": "MIT",
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.0.17"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"debug": "NODE_ENV=debug npm test",
"eject": "react-scripts eject"
},
"jest": {
"testURL": "http://localhost"
},
"devDependencies": {
"faker": "^4.1.0",
"jest-cli": "^22.0.4",
"jest": "^22.0.4",
"puppeteer": "^1.9.0"
}
}
我安装了以下插件:
有什么想法吗?
谢谢
【问题讨论】:
-
当您说“WebStorm 无法识别”时,您究竟是什么意思?我已经设置和配置了我的 jest.config.js 文件,当我从内置终端运行“npm run test”甚至只是“jest”时,它只会运行......
-
它确实没有将“beforeAll”视为关键字;它不像我在 VSCode 中看到的那样突出显示。我想我需要了解更多关于 jest 配置文件的信息
标签: javascript jestjs puppeteer