简体   繁体   English

业力无法检测到新的测试文件

[英]Karma does not detect new test files

I use karma as test runner for my Javascript test with enabled autoWatch option. 我将karma用作启用自动监视选项的Javascript测试的测试运行程序。 Every time a test file changes karma reruns the tests, how expected. 每次测试文件更改因果报应时,都会重新运行测试,以达到预期的效果。 But when I create a new test file karma does not detect this file automatically until I restart karma manually, although the new file matches the watched file pattern in the karma configuration. 但是,当我创建新的测试文件时,虽然新文件与karma配置中监视的文件模式匹配,但是直到手动重启karma时,karma才会自动检测到此文件。

How karma has to be configured in order to detect new test files automatically? 为了自动检测新的测试文件,必须如何配置业力?

Karma config is loaded only at startup. 业力配置仅在启动时加载。 So you need to wrap karma in some other runner. 因此,您需要将业力包装在其他跑步者中。

For example: you can use gulp . 例如:您可以使用gulp

gulp.watch can... watch for file changes and rerun karma from scratch (in order to reload the config). gulp.watch可以...监视文件更改,并从头开始运行karma(以便重新加载配置)。

For further details about implementation you could take a look at this: gulp-karma 有关实现的更多详细信息,您可以查看一下: gulp-karma

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM