karma-runner/karma

Extract watcher into an injected dependency

Open

#1,468 建立於 2015年6月24日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)JavaScript (1,703 fork)batch import
apidiscusshelp wantedtype: feature

倉庫指標

Star
 (11,918 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

I'm writing a plugin that integrates Karma with Broccoli so that it can lean fully on broccoli for all pre-processing, building, etc... The reason being that if you have a Brocfile, then you already have your build toolchain defined in one place, so you might as well utilize it from your test runner. That way, instead of maintaining a parallel build systems: one for your test runner and one for development/production, you can just npm install karma-broccoli and it will know how and when to build, and also which files the build generates. I have the single run use-case working where you invoke karma run. It waits until a build runs (if there is a build), and then executes the test suite.

For the config.autoWatch use-case, I'd like to replace the normal karma watcher with the Broccoli watcher for the same reason I want Broccoli to be responsible for the build, it already knows what to to watch for and consequently, what to build. It would be nice if I could just swap out the broccoli watcher for the bundled karma watcher, but at the moment it is hard coded to the watch function in watcher.js https://github.com/karma-runner/karma/blob/master/lib/server.js#L54

While the dependencies to the watch() function are injected, the watcher itself is not, so I'd like to see if you would be open to extracting the watcher into a first-class injected dependency. If so, I'd be happy to take a stab at implementing it.

貢獻者指南