Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Phantomjs在ember中失败,因为它找不到变量:google_Javascript_Ember.js_Npm_Phantomjs_Ember Cli - Fatal编程技术网

Javascript Phantomjs在ember中失败,因为它找不到变量:google

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: >

我正在我的ember项目上运行测试,当我在chrome上运行它时,它成功通过了,但当我在终端上使用phantomjs运行它时,它失败了,因为它
找不到变量: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中抓取屏幕截图。