UNPKG

typespec-bdd

Version:

BDD framework for TypeScript.

81 lines 2.52 kB
(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"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TestHooks { beforeTestRun() { } beforeFeature() { } beforeScenario() { } beforeCondition() { } afterCondition() { } afterScenario() { } afterFeature() { } afterTestRun() { } } exports.TestHooks = TestHooks; class TestReporter { summary(featureTitle, scenarioTitle, isSuccess) { console.info((isSuccess ? '✔' : '✘') + ' ' + featureTitle + ' : ' + scenarioTitle + '\n'); } error(featureTitle, condition, error) { console.error(featureTitle + '\n\n' + condition + '\n\n' + error); } information(message) { console.log(message); } complete() { console.log('Run has finished'); } escape(input) { return input.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); } } exports.TestReporter = TestReporter; class TapResult { constructor(hash, isOk, description) { this.hash = hash; this.isOk = isOk; this.description = description; } output() { return (this.isOk ? '' : 'not ') + 'ok ' + this.hash + ' ' + this.description; } } class TapReporter { constructor() { this.hash = 0; this.results = []; } summary(featureTitle, scenarioTitle, isSuccess) { this.hash++; this.results.push(new TapResult(this.hash, isSuccess, featureTitle + ': ' + scenarioTitle)); } error(featureTitle, condition, error) { } information(message) { } complete() { console.log('1..' + this.results.length); for (const result of this.results) { console.log(result.output()); } } } exports.TapReporter = TapReporter; }); //# sourceMappingURL=Hooks.js.map