强制 Karma 从磁盘获取更新的 spec.js 文件
Force Karma to take updated spec.js file from disk
我正在为 angular 控制器编写测试规范,请这样说:
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
在命令中 window。不久之后我意识到我需要使用 scope
而不是 $scope
,所以我保存 spec.js
文件,CTRL + C
在 Karma window 中,重新打开浏览器,按调试并重试。当我编写测试规范时,这种情况不断发生。
我可以强制 Karma 从磁盘中获取最新的 spec.js
文件而不让我重复这个过程吗?
当您 运行 时使用自动手表开关:
--autoWatch
您还可以使用 autoWatchBatchDelay 告诉它在 运行 之前等待一段设定的时间:
autoWatchBatchDelay:500
都在配置选项里:http://karma-runner.github.io/0.13/config/configuration-file.html
我正在为 angular 控制器编写测试规范,请这样说:
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
在命令中 window。不久之后我意识到我需要使用 scope
而不是 $scope
,所以我保存 spec.js
文件,CTRL + C
在 Karma window 中,重新打开浏览器,按调试并重试。当我编写测试规范时,这种情况不断发生。
我可以强制 Karma 从磁盘中获取最新的 spec.js
文件而不让我重复这个过程吗?
当您 运行 时使用自动手表开关:
--autoWatch
您还可以使用 autoWatchBatchDelay 告诉它在 运行 之前等待一段设定的时间:
autoWatchBatchDelay:500
都在配置选项里:http://karma-runner.github.io/0.13/config/configuration-file.html