我在 OsX 上,使用 nvm,节点 10.15.3。 Testscafe(非实时)工作正常,但我试图按照 Testcafe-live 上的说明进行操作
在解释如何在本地安装的步骤
If you have installed testcafe-live locally to your project, add an npm script to package.json to run tests:
它指的是一个package.json文件,我在scripts部分添加了条目
"scripts": {
"test": "eslint ./**/*.js",
"testcafe-live": "testcafe-live chrome tests/"
},
但是当我运行的时候
npm run testcafe-live
我收到这些错误:
npm ERR! path /Users/Thomas.Pavan/testcafe/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/Thomas.Pavan/testcafe/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Thomas.Pavan/.npm/_logs/2019-03-11T14_58_28_946Z-debug.log
我看到 package.json 路径有问题,我的 package.json 文件在 ~/testcafe/node_modules/testcafe-live 但 npm 正在查看/Users/Thomas.Pavan/testcafe/。 如果我将 testcafe-live 安装在错误的位置(目前在 ~/testcafe)我的项目根文件夹,我会感到困惑,而且我也不明白在哪里可以更改错误中显示的路径。 长话短说,package.json 文件应该在我的文件夹的根目录中,但按照说明安装 testcafe-live,创建一个 node_modules 文件夹,package.json 文件嵌套在那里。
最佳答案
感谢您对 TestCafe 的关注。 从 1.0.0 版开始,TestCafe 具有内置的实时模式功能,不需要任何外部模块。您提到的存储库现在已过时。 详情请引用以下文章https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/live-mode.html
关于npm - Testcafe live 没有运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55105328/