簡體   English   中英

強制業力從磁盤上獲取更新的spec.js文件

[英]Force Karma to take updated spec.js file from disk

我正在為角度控制器編寫測試規范,這樣說:

it('should have a method to add a blank category', function () {
    var controller = CategoryControllerCreator();
    $scope.allcategories = {};
    $scope.addCategoryStart();
    expect($scope.allcategories["ID-1"]).not.toBeUndefined();
});

然后,我需要對其進行測試以查看其是否有效。 所以我跑:

karma start

在命令窗口中。 很快我意識到我需要使用scope而不是$scope ,所以我在Karma窗口中保存了spec.js文件CTRL + C ,重新打開瀏覽器,按debug並再試一次。 當我編寫測試規范時,這種情況一直持續下去。

我可以強迫Karma只從磁盤上獲取最新的spec.js文件,而不必讓我重復此過程嗎?

在運行時使用自動監視開關:

--autoWatch

並且您還可以告訴它在使用autoWatchBatchDelay運行之前,要等待一定的時間:

autoWatchBatchDelay:500

全部位於配置選項中: http : //karma-runner.github.io/0.13/config/configuration-file.html

暫無
暫無

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

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