Javascript Phantomjs在ember中失败,因为它找不到变量:google
我正在我的ember项目上运行测试,当我在chrome上运行它时,它成功通过了,但当我在终端上使用phantomjs运行它时,它失败了,因为它Javascript Phantomjs在ember中失败,因为它找不到变量:google,javascript,ember.js,npm,phantomjs,ember-cli,Javascript,Ember.js,Npm,Phantomjs,Ember Cli,我正在我的ember项目上运行测试,当我在chrome上运行它时,它成功通过了,但当我在终端上使用phantomjs运行它时,它失败了,因为它找不到变量:google。 在单元测试文件中,我有/*global google*/,它适用于在chrome中运行的测试,但不适用于phantomjs测试 这是一个失败测试的示例: not ok 8 PhantomJS 1.9 - component:street-view: it renders --- actual: >
找不到变量:google
。
在单元测试文件中,我有/*global google*/
,它适用于在chrome中运行的测试,但不适用于phantomjs测试
这是一个失败测试的示例:
not ok 8 PhantomJS 1.9 - component:street-view: it renders
---
actual: >
null
message: >
Died on test #2 at http://localhost:7357/assets/test-support.js:2934
at test (http://localhost:7357/assets/test-support.js:1826)
at http://localhost:7357/assets/dummy.js:395
at http://localhost:7357/assets/vendor.js:150
at tryFinally (http://localhost:7357/assets/vendor.js:30)
at http://localhost:7357/assets/vendor.js:156
at http://localhost:7357/assets/test-loader.js:29
at http://localhost:7357/assets/test-loader.js:21
at http://localhost:7357/assets/test-loader.js:40
at http://localhost:7357/assets/test-support.js:6647: Can't find variable: google
Log: |
...
我还尝试将google添加到.jshintrc
文件中的“predef”
,但也没有成功
有人对此有任何可能的解决方案吗?如果谷歌允许在无头浏览器上加载其库,简单的测试可能是编写一个小脚本来打开街景,并在phantomjs中抓取屏幕截图。