TestCafe Live没有运行

时间:2019-03-11 15:31:04

标签: npm automated-tests e2e-testing web-testing testcafe

我在OsX上,使用节点10.1.5.3的nvm。 Testscafe(无法运行)工作正常,但我尝试按照Testcafe-live

上的说明进行操作

在解释如何在本地安装的步骤

  

如果您已在本地将testcafe-live安装到项目中,请添加一个   将npm脚本打包到package.json以运行测试:

它指向package.json文件,我在脚本部分下添加了该条目

   "scripts": {
    "test": "eslint ./**/*.js",
    "testcafe-live": "testcafe-live chrome tests/"
  },

但是当我跑步

  

npm运行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文件嵌套在其中。

1 个答案:

答案 0 :(得分:5)

感谢您对TestCafe的关注。 从1.0.0版开始,TestCafe具有内置的实时模式功能,不需要任何外部模块。您提到的存储库现在已过时。 请参阅以下文章,以获取更多详细信息https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/live-mode.html