// tslint:disable:no-console
// tslint:disable:ordered-imports
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "@web-atoms/unit-test/dist/TestRunner"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    // import unit test modules here
    var TestRunner_1 = require("@web-atoms/unit-test/dist/TestRunner");
    // tslint:disable-next-line:no-var-requires
    var _a = require("fs"), statSync = _a.statSync, readdirSync = _a.readdirSync;
    // tslint:disable-next-line:no-var-requires
    var path = require("path");
    global.CustomEvent = function CustomEvent(type, p) {
        var e = document.createEvent("CustomEvent");
        var pe = p ? __assign({}, p) : {};
        e.initCustomEvent(type, pe.bubble, pe.cancelable, pe.detail);
        return e;
    };
    function loadScripts(start) {
        for (var _i = 0, _a = readdirSync(start); _i < _a.length; _i++) {
            var item = _a[_i];
            var file = start + "/" + item;
            // const file = item;
            var s = statSync(file);
            if (s.isDirectory()) {
                loadScripts(file);
                continue;
            }
            if (file.endsWith(".js")) {
                var md = file.substr(0, file.length - 3);
                require("." + md);
            }
        }
    }
    loadScripts("./dist/tests");
    var instance = TestRunner_1.default.instance;
    instance.run().then(function () {
        process.exit();
    }).catch(function (e) {
        console.error(e.message);
        if (e.stack) {
            console.error(e.stack);
        }
        process.exit(1);
    });
});
//# sourceMappingURL=test.js.map