-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Problem
When incrementally recompiling ClojureScript, many files are changed as the compilation process runs. Currently, it is difficult to use Karma to autorun tests after detecting a ClojureScript recompile, because as soon as the first file is changed, Karma wants to rerun the tests.
Current behaviour
There is a config option autoWatchBatchDelay
available which at first seems like it would be ideal for this use case. It starts a timer after it detects the first file system change, and waits n milliseconds before running tests. It is possible to use this option, but it is suboptimal.
The timer starts from the first change detected, so when configuring this parameter, I need to specify what the maximum time my ClojureScript compile could take, so it doesn't start rerunning while recompiling. I can shoot for a low number that my app will recompile in (say 1 second), but then will hit problems if an incremental recompile takes longer (which happens from time to time when editing certain files).
Proposed behaviour
I propose that there is a new option autoWatchDelay
(or perhaps changing the behaviour of the current option) to start the delay timer from the last filesystem change detected, waiting n more milliseconds before starting the tests. In practice this might look like resetting the timer, each time a new file change was detected.
IMHO this behaviour is probably closer to what most people are wanting when they use autoWatchBatchDelay
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
- Bump karma from ~1.2.0 to ~6.4 in /redpen-serverkarronoli/redpen
- [Snyk] Upgrade: lodash, , , , , , , , , , , , , , angular2-moment, angular2-qrcode, codecov, ionic-angular, jasmine-core, jasmine-spec-reporter, karma, karma-chrome-launcher, karma-coverage-istanbul-reporter, karma-jasmine, serve-static, ts-node, tslint, typescript, webdriver-manager, zone.jssatoshinakamoto007/bitcore
Activity
nschipperbrainsmith commentedon Sep 22, 2016
Think the thing most of us would like to have is a system that allows us to debounce the incoming changes till no further changes have occurred for an x amount of ms.
A perfect example of this is illustrated within RXJS:
http://reactivex.io/documentation/operators/debounce.html
Having an option like that would be very useful.
Stand alone version of debounce:
https://davidwalsh.name/javascript-debounce-function
Which would mean the following function probably would have to be modified:
https://github.com/karma-runner/karma/blob/master/lib/watcher.js#L93
Once i change the bind function to this i have the desired behaviour:
danielcompton commentedon Sep 22, 2016
@schippie this is exactly what I'm after.
dignifiedquire commentedon Sep 22, 2016
Sounds good to me. I agree it does make sense to change the option to this behaviour.
danielcompton commentedon Oct 25, 2016
awaitWriteFinish
looks useful and may be helpful, but wouldn't solve this problem on it's own probably. I still need to handle the case where multiple files are written in one recompile cycle.feat(watcher): Debounce autoWatchBatchDelay
feat(watcher): Debounce autoWatchBatchDelay
feat(watcher): Debounce autoWatchBatchDelay
feat(watcher): Debounce autoWatchBatchDelay
feat(watcher): Debounce autoWatchBatchDelay
feat(watcher): Debounce autoWatchBatchDelay
7 remaining items