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

时间:2015-10-06 19:39:28

标签: javascript ember.js npm phantomjs ember-cli

我在我的ember项目上运行测试,当我在chrome上运行它时它成功通过,但是当我使用phantomjs在终端中运行它时,它失败了,因为它Can't find variable: 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添加到"predef"文件中的.jshintrc,但这也无效。

任何人都可以解决这个问题吗?

0 个答案:

没有答案