我正在尝试将手表与jasmine-spec-reporter结合起来,这是我的gulpfile:
import Jasmine from 'jasmine';
import SpecReporter from 'jasmine-spec-reporter';
gulp.task('watch', () => {
gulp.watch('./spec/**/*[sS]pec.js', ['jasmine']);
});
gulp.task('jasmine', () => {
let jasmine = new Jasmine();
jasmine.env.clearReporters();
jasmine.addReporter(new SpecReporter());
jasmine.loadConfigFile();
jasmine.execute();
});
如果我运行gulp jasmine
它运行正常,但如果我运行监视任务它只执行一次:
$ gulp watch
> Starting 'watch'...
> Finished 'watch' after 8.82 ms
> Starting 'jasmine'...
> Spec started
>
> MyClass
> ✓ exists
> ✓ has a size
>
> add()
> ✓ is a function
> ✓ increases the size
>
> myFunction()
> ✓ is a function
>
> Executed 5 of 5 specs SUCCESS in 0.007 sec.
$
是否可以使用gulp运行jasmine-spec-runner,以便在监视任务触发时连续执行?
答案 0 :(得分:0)
您是否尝试过禁用Karma.conf.js
配置文件中的singleRun开关?
singleRun: false
我假设你正在使用Karma