Istanbul.js在AMD模块的封面时失败

时间:2015-07-20 20:22:58

标签: javascript backbone.js requirejs istanbul

我使用Backbone / Marionette和RequireJS使用AMD风格的模块编写应用程序,并尝试向其添加覆盖步骤,但是,当运行istanbul cover myTestFile.js时,istanbul会抛出此错误:

  

__ cov_EsyvGtIcLKP7TgjU5WMSQw.s [' 1'] ++;定义(函数(要求){__ cov_EsyvGtIcL   define is not defined

我没有解决这个问题,因为我从未对浏览器端代码做过报道,这是我第一次使用AMD风格模块。

伊斯坦布尔还说已经写了一份报道,所以我不明白这是否意味着它实际上是否成功运行。

任何指针都会有很大的帮助。这是istanbul cover mytestfile.js命令的完整输出(更改了一些详细信息):

=============================================================================
Writing coverage object [/Users/myuser/src/myapp/coverage/coverage.json]
Writing coverage reports at [/Users/myuser/src/myapp/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 5% ( 1/20 )
Branches     : 0% ( 0/2 )
Functions    : 0% ( 0/5 )
Lines        : 5% ( 1/20 )
================================================================================
/Users/myuser/src/myapp/app/myapp/app-collection.js:9
__cov_EsyvGtIcLKP7TgjU5WMSQw.s['1']++;define(function(require){__cov_EsyvGtIcL
                                      ^
ReferenceError: define is not defined
    at Object.<anonymous> (/Users/mysuser/src/myapp/app/myapp/app-collection.js:9:39)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/istanbul/lib/hook.js:107:24)
    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 Object.<anonymous> (/Users/myuser/src/myapp/test/specs/applications-tests.js:9:25)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

0 个答案:

没有答案