Innovenergy_trunk/frontend/node_modules/testcafe/lib/live/controller.js

109 lines
13 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = __importDefault(require("events"));
const logger_1 = __importDefault(require("./logger"));
const file_watcher_1 = __importDefault(require("./file-watcher"));
const keyboard_observer_1 = __importDefault(require("./keyboard-observer"));
const types_1 = require("../errors/types");
const runtime_1 = require("../errors/runtime");
class LiveModeController extends events_1.default {
constructor(runner) {
super();
this.running = false;
this.restarting = false;
this.watchingPaused = false;
this.stopping = false;
this.logger = new logger_1.default();
this.runner = runner;
this.keyboardObserver = this._createKeyboardObserver();
this.fileWatcher = this._createFileWatcher();
}
_isTestFilesNotFoundError(err) {
// @ts-ignore
return runtime_1.GeneralError.isGeneralError(err) && err.code === types_1.RUNTIME_ERRORS.testFilesNotFound;
}
init(files) {
this.keyboardObserver.push(this);
this._initFileWatching(files);
this._setRunning();
return Promise.resolve()
.then(() => this.logger.writeIntroMessage(files));
}
dispose() {
this.fileWatcher.stop();
this.keyboardObserver.remove(this);
}
runTests(sourceChanged) {
if (this.watchingPaused || this.running)
return Promise.resolve();
this._setRunning();
this.logger.writeRunTestsMessage(sourceChanged);
return this.runner.runTests();
}
onTestRunDone(err) {
this.running = false;
if (this._isTestFilesNotFoundError(err))
throw err;
if (!this.restarting)
this.logger.writeTestsFinishedMessage();
if (err)
this.logger.err(err);
}
toggleWatching() {
this.watchingPaused = !this.watchingPaused;
this.logger.writeToggleWatchingMessage(!this.watchingPaused);
}
stop() {
if (!this.runner || !this.running) {
this.logger.writeNothingToStopMessage();
return Promise.resolve();
}
this.logger.writeStopRunningMessage();
return this.runner.suspend()
.then(() => {
this.restarting = false;
this.running = false;
});
}
restart() {
if (this.restarting || this.watchingPaused)
return Promise.resolve();
this.restarting = true;
if (this.running) {
return this.stop()
.then(() => this.logger.writeTestsFinishedMessage())
.then(() => this.runTests());
}
return this.runTests();
}
exit() {
if (this.stopping)
return Promise.resolve();
this.logger.writeExitMessage();
this.stopping = true;
return this.runner ? this.runner.exit() : Promise.resolve();
}
addFileToWatches(filename) {
this.fileWatcher.addFile(this, filename);
}
_createFileWatcher() {
return new file_watcher_1.default();
}
_createKeyboardObserver() {
return new keyboard_observer_1.default();
}
_initFileWatching(files) {
files.forEach(file => this.addFileToWatches(file));
}
_setRunning() {
this.running = true;
this.restarting = false;
this.stopping = false;
}
}
exports.default = LiveModeController;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saXZlL2NvbnRyb2xsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxvREFBa0M7QUFDbEMsc0RBQThCO0FBQzlCLGtFQUF5QztBQUN6Qyw0RUFBZ0U7QUFFaEUsMkNBQWlEO0FBQ2pELCtDQUFpRDtBQUdqRCxNQUFNLGtCQUFtQixTQUFRLGdCQUFZO0lBZXpDLFlBQW9CLE1BQXNCO1FBQ3RDLEtBQUssRUFBRSxDQUFDO1FBRVIsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLENBQUM7UUFDckIsSUFBSSxDQUFDLFVBQVUsR0FBRyxLQUFLLENBQUM7UUFDeEIsSUFBSSxDQUFDLGNBQWMsR0FBRyxLQUFLLENBQUM7UUFDNUIsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUM7UUFDdEIsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFJLGdCQUFNLEVBQUUsQ0FBQztRQUMzQixJQUFJLENBQUMsTUFBTSxHQUFHLE1BQU0sQ0FBQztRQUVyQixJQUFJLENBQUMsZ0JBQWdCLEdBQUcsSUFBSSxDQUFDLHVCQUF1QixFQUFFLENBQUM7UUFDdkQsSUFBSS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