ReferenceError:运行Jasmine

时间:2015-09-11 23:35:40

标签: javascript unit-testing jasmine

我尝试通过命令行使用Jasmine框架执行shaka-player源代码中的测试。但我收到此错误消息:

/Documents/shaka-player/spec/mpd_spec.js:19
goog.require('shaka.dash.mpd');
^
ReferenceError: goog is not defined
    at Object.<anonymous> (/Documents/shaka-player/spec/mpd_spec.js:19:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /usr/lib/node_modules/jasmine/lib/jasmine.js:63:5
    at Array.forEach (native)
    at Jasmine.loadSpecs (/usr/lib/node_modules/jasmine/lib/jasmine.js:62:18)

我配置了jasmine.json文件,将unit_tests.html文件所需的相同输入放在浏览器中执行测试。我还编译了整个源代码,执行build / build.sh脚本,并且还将编译后的代码放在输入列表中。 jasmine.json文件类似于:

{
"spec_dir": "spec",
"spec_files": [
    "mpd_spec.js",
    "util.js"
],
"inputs": [
    "shaka-player.compiled.js",
    "third_party/jasmine/lib/jasmine-2.1.3/jasmine.js",
    "third_party/jasmine/lib/jasmine-2.1.3/jasmine-html.js",
    "third_party/jasmine/lib/jasmine-2.1.3/boot.js",
    "third_party/jasmine/lib/jasmine-ajax-3.1.0/mock-ajax.js",
    "third_party/blanket_jasmine/blanket_jasmine.js",
    "third_party/closure/goog/base.js"
   ]
}

我使用JASMINE_CONFIG_PATH执行了jasmine,如下所示:

jasmine JASMINE_CONFIG_PATH=spec/support/jasmine.json

我做错了什么?

提前致谢。

0 个答案:

没有答案