GUI starting point
Change-Id: Ic7d23bfce0307c4b7cfc9fad9fb5834286ee195c
diff --git a/gulp_tasks/karma.js b/gulp_tasks/karma.js
new file mode 100644
index 0000000..98aaf1d
--- /dev/null
+++ b/gulp_tasks/karma.js
@@ -0,0 +1,27 @@
+process.env.NODE_ENV = 'test';
+
+const path = require('path');
+
+const gulp = require('gulp');
+const karma = require('karma');
+
+gulp.task('karma:single-run', karmaSingleRun);
+gulp.task('karma:auto-run', karmaAutoRun);
+
+function karmaFinishHandler(done) {
+ return failCount => {
+ done(failCount ? new Error(`Failed ${failCount} tests.`) : null);
+ };
+}
+
+function karmaSingleRun(done) {
+ const configFile = path.join(process.cwd(), 'conf', 'karma.conf.js');
+ const karmaServer = new karma.Server({configFile}, karmaFinishHandler(done));
+ karmaServer.start();
+}
+
+function karmaAutoRun(done) {
+ const configFile = path.join(process.cwd(), 'conf', 'karma-auto.conf.js');
+ const karmaServer = new karma.Server({configFile}, karmaFinishHandler(done));
+ karmaServer.start();
+}