flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
62 lines • 2.75 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("../command");
const cli_1 = require("../cli");
const flagpole_execution_1 = require("../../flagpole-execution");
class List extends command_1.Command {
constructor() {
super(...arguments);
this.commandString = "list [type]";
this.description = "list out the suites, environments or tags in this project";
}
action(type = "suites") {
return __awaiter(this, void 0, void 0, function* () {
if (["env", "envs", "environment", "environments"].includes(type)) {
return listEnvironments();
}
if (["tag", "tags"].includes(type)) {
return listTags();
}
return listSuites();
});
}
}
exports.default = List;
function listEnvironments() {
cli_1.Cli.subheader("List Environments").log("");
const envNames = flagpole_execution_1.FlagpoleExecution.global.config.getEnvironmentNames();
if (envNames.length > 0) {
return cli_1.Cli.log("Found these environments:").list(envNames).log("").exit(0);
}
return cli_1.Cli.log("Did not find any environments.").exit(2);
}
function listTags() {
cli_1.Cli.subheader("List Tags").log("");
const tags = flagpole_execution_1.FlagpoleExecution.global.config.getTags() || [];
if (tags.length > 0) {
return cli_1.Cli.log("Found these tags:").list(tags).log("").exit(0);
}
else {
return cli_1.Cli.log("Did not find any tags.").exit(2);
}
}
function listSuites() {
cli_1.Cli.subheader("List Suites").log(`Looking in folder: ${flagpole_execution_1.FlagpoleExecution.global.config.getTestsFolder()}`, "");
const suiteNames = flagpole_execution_1.FlagpoleExecution.global.config.getSuiteNames();
if (suiteNames.length > 0) {
cli_1.Cli.log("Found these test suites:").list(suiteNames).log("").exit(0);
}
else {
cli_1.Cli.log("Did not find any test suites.").exit(2);
}
}
//# sourceMappingURL=list.js.map