import {buildHelper as helper, taskRunner} from "../Container";
import Util from "../Util";
const gulp = require("gulp4");
const mocha = require("gulp-mocha");

export default function Test() {
    return gulp.src(helper.getSettings().test, {read: false})
        .pipe(mocha({
            reporter: 'spec',
            compilers: {
                ts: require('ts-node/register')
            }
        }))
        .once('end', function () {
            process.exit();
        })
        .on("error", (error) => {
            console.error(Util.formatError(error));
            process.exit(1)
        });
}
import {buildHelper as helper, taskRunner} from "../Container";
import Util from "../Util";
const gulp = require("gulp4");
const mocha = require("gulp-mocha");

export default function Test() {
    return gulp.src(helper.getSettings().test, {read: false})
        .pipe(mocha({
            reporter: 'spec',
            compilers: {
                ts: require('ts-node/register')
            }
        }))
        .on("error", (error) => {
            console.error(Util.formatError(error));
            process.exit(1)
        });
}
--- 
+++ 
@@ -11,6 +11,9 @@
                 ts: require('ts-node/register')
             }
         }))
+        .once('end', function () {
+            process.exit();
+        })
         .on("error", (error) => {
             console.error(Util.formatError(error));
             process.exit(1)
Exit karma on test end to fix hanging tests
