簡體   English   中英

調試Karma單元測試

[英]Debug a Karma unit test

我正在嘗試調試單元測試。 我正在使用Karma(BTW,它是AngularJS項目)。 我已經設法啟動了業力服務器,因此,當我啟動業力時,我得到了頁面的右上角有調試器按鈕。 當我單擊它時,我得到一個白頁。 在js控制台中,我看到以下錯誤

未捕獲到的TypeError:對象#沒有方法'start'debug.html:35窗口。 業力 .loaded debug.html:35(匿名函數)

奇怪的是,在debug.html中沒有諸如start方法之類的東西:(

window.__karma__ = {
  info: function(info) {
    if (info.dump && window.console) window.console.log(info.dump);
  },
  complete: function() {},
  store: function() {},
  result: window.console ? function(result) {
    var msg = result.skipped ? 'SKIPPED' : (result.success ? 'SUCCESS ' : 'FAILED ');
    window.console.log(msg + result.suite.join(' ') + ' ' + result.description);

    for (var i = 0; i < result.log.length; i++) {
      window.console.error(result.log[i]);
    }
  } : function() {},
  loaded: function() {
    this.start();
  }
};

// All served files with the latest timestamps
window.__karma__.files = {

};

在該文件窗口的主體中。 業力 .loaded(); 叫做。

有什么建議可能出什么問題嗎?

問題是window.__karma__.files為空。 驗證配置文件是否正確,並使用karma start my.conf.js運行它(如果未命名為karma.conf.js),請karma start my.conf.js

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM