我正在尝试使用Ember测试来集成自动化测试。
该应用程序在浏览器上运行良好,没有任何错误。我试着简单地跑
ember test在命令行上,但得到一堆全局错误,所有测试都失败。
以下是我得到的错误:
not ok 1 PhantomJS 2.1 - Global error: SyntaxError: Unexpected token ',' at http://localhost:4302/assets/vendor.js, line 145617
not ok 2 PhantomJS 2.1 - Global error: Error: Could not find module ember-metal/core required by: ember-testing/index at http://localhost:4302/assets/test-support.js, line 62
not ok 3 PhantomJS 2.1 - Global error: ReferenceError: Can't find variable: define at http://localhost:4302/assets/tests.js, line 1
...当我在浏览器上运行测试时,我没有得到语法错误(上面的第一个错误),第一个错误是
Uncaught Error: Could not find module `analogue/resolver` imported from `analogue/tests/helpers/resolver`这些对我来说没有意义,因为我不应该编辑vendor.js,而且它说找不到的模块就在那里。有什么想法吗?
发布于 2016-10-04 21:21:52
以防其他人(像我)在这里遇到类似的问题。
在我的例子中,错误列表总是以一个随机的SyntaxError开头(有时是'(‘或'!')。实际引用的行通常甚至从未包含这些符号。
我的解决方案是将phantomjs从2.1版本降级到1.9版本
npm install -g phantomjs@1.9.20(在这些情况下,使用nvm或nave可以让您的工作更轻松)
发布于 2017-05-16 18:50:40
在我的例子中,我只需要一个全新的PhantomJS安装
npm uninstall phantomjs -g
npm install phantomjs -ghttps://stackoverflow.com/questions/38489157
复制相似问题