@betterer/betterer
Advanced tools
Comparing version 1.2.0 to 1.2.1
import { BettererConfig } from '../config'; | ||
import { BettererReporters } from '../reporters'; | ||
import { BettererReporter } from '../reporters'; | ||
import { BettererFilePaths } from '../watcher'; | ||
@@ -9,3 +9,3 @@ import { BettererRun } from './run'; | ||
readonly config: BettererConfig; | ||
private _reporters?; | ||
private _reporter?; | ||
private _stats; | ||
@@ -16,3 +16,3 @@ private _tests; | ||
private _finish; | ||
constructor(config: BettererConfig, _reporters?: BettererReporters | undefined); | ||
constructor(config: BettererConfig, _reporter?: BettererReporter | undefined); | ||
setup(): Promise<void>; | ||
@@ -19,0 +19,0 @@ tearDown(): void; |
@@ -22,6 +22,6 @@ "use strict"; | ||
var BettererContext = /** @class */ (function () { | ||
function BettererContext(config, _reporters) { | ||
var _a, _b, _c; | ||
function BettererContext(config, _reporter) { | ||
var _a, _b; | ||
this.config = config; | ||
this._reporters = _reporters; | ||
this._reporter = _reporter; | ||
this._stats = null; | ||
@@ -32,3 +32,3 @@ this._tests = []; | ||
this._finish = null; | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.call(_b); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.contextStart) === null || _b === void 0 ? void 0 : _b.call(_a); | ||
} | ||
@@ -56,9 +56,9 @@ BettererContext.prototype.setup = function () { | ||
BettererContext.prototype.tearDown = function () { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
assert.equal(this._status, BettererContextStatus.end); | ||
assert(this._stats); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.finish) === null || _c === void 0 ? void 0 : _c.call(_b, this._stats); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.contextEnd) === null || _b === void 0 ? void 0 : _b.call(_a, this._stats); | ||
}; | ||
BettererContext.prototype.runnerStart = function (files) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
if (files === void 0) { files = []; } | ||
@@ -68,11 +68,11 @@ return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
return tslib_1.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
assert.equal(this._status, BettererContextStatus.ready); | ||
this._stats = new statistics_1.BettererStats(); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.runner) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.call(_b, files); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.runsStart) === null || _b === void 0 ? void 0 : _b.call(_a, files); | ||
return [4 /*yield*/, this._initExpected()]; | ||
case 1: | ||
expectedRaw = _d.sent(); | ||
expectedRaw = _c.sent(); | ||
runs = this._tests.map(function (test) { | ||
@@ -96,7 +96,7 @@ var name = test.name; | ||
BettererContext.prototype.runnerEnd = function (runs, files) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
if (files === void 0) { files = []; } | ||
assert.equal(this._status, BettererContextStatus.running); | ||
assert(this._finish); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.runner) === null || _b === void 0 ? void 0 : _b.end) === null || _c === void 0 ? void 0 : _c.call(_b, runs, files); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.runsEnd) === null || _b === void 0 ? void 0 : _b.call(_a, runs, files); | ||
this._status = BettererContextStatus.end; | ||
@@ -106,3 +106,3 @@ this._finish(); | ||
BettererContext.prototype.runStart = function (run) { | ||
var _a, _b, _c, _d, _e, _f; | ||
var _a, _b; | ||
assert(this._stats); | ||
@@ -112,26 +112,19 @@ var isExpired = run.isExpired, name = run.name; | ||
this._stats.expired.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.expired) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
} | ||
(_f = (_e = (_d = this._reporters) === null || _d === void 0 ? void 0 : _d.run) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.call(_e, run); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.runStart) === null || _b === void 0 ? void 0 : _b.call(_a, run); | ||
}; | ||
BettererContext.prototype.runBetter = function (run) { | ||
var _a, _b, _c; | ||
assert(this._stats); | ||
var name = run.name; | ||
this._stats.better.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.better) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
}; | ||
BettererContext.prototype.runFailed = function (run) { | ||
var _a, _b, _c; | ||
assert(this._stats); | ||
var name = run.name; | ||
this._stats.failed.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.failed) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
}; | ||
BettererContext.prototype.runNew = function (run) { | ||
var _a, _b, _c; | ||
assert(this._stats); | ||
var name = run.name; | ||
this._stats.new.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.neww) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
}; | ||
@@ -143,7 +136,5 @@ BettererContext.prototype.runRan = function (run) { | ||
BettererContext.prototype.runSame = function (run) { | ||
var _a, _b, _c; | ||
assert(this._stats); | ||
var name = run.name; | ||
this._stats.same.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.same) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
}; | ||
@@ -156,9 +147,8 @@ BettererContext.prototype.runSkipped = function (run) { | ||
BettererContext.prototype.runWorse = function (run) { | ||
var _a, _b, _c; | ||
assert(this._stats); | ||
var name = run.name; | ||
this._stats.worse.push(name); | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.worse) === null || _c === void 0 ? void 0 : _c.call(_b, run); | ||
}; | ||
BettererContext.prototype.runEnd = function (run) { | ||
var _a, _b; | ||
assert(this._stats); | ||
@@ -169,9 +159,10 @@ var isComplete = run.isComplete, name = run.name; | ||
} | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.runEnd) === null || _b === void 0 ? void 0 : _b.call(_a, run); | ||
}; | ||
BettererContext.prototype.process = function (runs) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var printed, error, e_1; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
return tslib_1.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
@@ -182,13 +173,13 @@ assert.equal(this._status, BettererContextStatus.end); | ||
case 1: | ||
printed = _d.sent(); | ||
printed = _c.sent(); | ||
error = null; | ||
_d.label = 2; | ||
_c.label = 2; | ||
case 2: | ||
_d.trys.push([2, 4, , 5]); | ||
_c.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, results_1.write(printed, this.config.resultsPath)]; | ||
case 3: | ||
_d.sent(); | ||
_c.sent(); | ||
return [3 /*break*/, 5]; | ||
case 4: | ||
e_1 = _d.sent(); | ||
e_1 = _c.sent(); | ||
error = e_1; | ||
@@ -198,3 +189,3 @@ return [3 /*break*/, 5]; | ||
if (error) { | ||
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.call(_b, error, printed); | ||
(_b = (_a = this._reporter) === null || _a === void 0 ? void 0 : _a.contextError) === null || _b === void 0 ? void 0 : _b.call(_a, error, printed); | ||
} | ||
@@ -281,2 +272,2 @@ return [2 /*return*/, this._stats]; | ||
exports.BettererContext = BettererContext; | ||
//# sourceMappingURL=context.js.map | ||
//# sourceMappingURL=context.js.map |
@@ -26,3 +26,3 @@ "use strict"; | ||
case 0: | ||
context = new context_1.BettererContext(config, reporters_1.serialReporters); | ||
context = new context_1.BettererContext(config, reporters_1.reporterSerial); | ||
return [4 /*yield*/, context.setup()]; | ||
@@ -78,3 +78,3 @@ case 1: | ||
case 0: | ||
context = new context_1.BettererContext(config, reporters_1.parallelReporters); | ||
context = new context_1.BettererContext(config, reporters_1.reporterParallel); | ||
watcher = new watcher_1.BettererWatcher(context, function (filePaths) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -81,0 +81,0 @@ return tslib_1.__generator(this, function (_a) { |
@@ -0,9 +1,2 @@ | ||
export { reporterParallel, reporterSerial } from './reporters'; | ||
export * from './types'; | ||
export declare const parallelReporters: { | ||
context: import("./types").BettererContextReporter; | ||
runner: import("./types").BettererRunnerReporter; | ||
}; | ||
export declare const serialReporters: { | ||
context: import("./types").BettererContextReporter; | ||
run: import("./types").BettererRunReporter; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.serialReporters = exports.parallelReporters = void 0; | ||
var tslib_1 = require("tslib"); | ||
var context_reporters_1 = require("./context-reporters"); | ||
var runner_reporters_1 = require("./runner-reporters"); | ||
var run_reporters_1 = require("./run-reporters"); | ||
var reporters_1 = require("./reporters"); | ||
Object.defineProperty(exports, "reporterParallel", { enumerable: true, get: function () { return reporters_1.reporterParallel; } }); | ||
Object.defineProperty(exports, "reporterSerial", { enumerable: true, get: function () { return reporters_1.reporterSerial; } }); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
exports.parallelReporters = { | ||
context: context_reporters_1.contextParallel, | ||
runner: runner_reporters_1.runnerParallel | ||
}; | ||
exports.serialReporters = { | ||
context: context_reporters_1.contextSerial, | ||
run: run_reporters_1.runSerial | ||
}; | ||
//# sourceMappingURL=index.js.map |
import { BettererError } from '@betterer/errors'; | ||
import { BettererRuns, BettererRun, BettererStats } from '../context'; | ||
import { BettererFilePaths } from '../watcher'; | ||
export declare type BettererContextReporter = { | ||
start(): void; | ||
finish(stats: BettererStats): void; | ||
error(error: BettererError, printed: Array<string>): void; | ||
export declare type BettererReporter = { | ||
contextStart?(): void; | ||
contextEnd?(stats: BettererStats): void; | ||
contextError?(error: BettererError, printed: Array<string>): void; | ||
runsStart?(files: BettererFilePaths): void; | ||
runsEnd?(runs: BettererRuns, files: BettererFilePaths): void; | ||
runStart?(run: BettererRun): void; | ||
runEnd?(run: BettererRun): void; | ||
}; | ||
export declare type BettererRunnerReporter = { | ||
start(files: BettererFilePaths): void; | ||
end(runs: BettererRuns, files: BettererFilePaths): void; | ||
}; | ||
export declare type BettererRunReporter = { | ||
better(run: BettererRun): void; | ||
expired(run: BettererRun): void; | ||
failed(run: BettererRun): void; | ||
neww(run: BettererRun): void; | ||
same(run: BettererRun): void; | ||
start(run: BettererRun): void; | ||
worse(run: BettererRun): void; | ||
}; | ||
export declare type BettererReporters = { | ||
context?: BettererContextReporter; | ||
runner?: BettererRunnerReporter; | ||
run?: BettererRunReporter; | ||
}; |
@@ -6,13 +6,11 @@ "use strict"; | ||
var printed = '{\n'; | ||
Object.keys(serialised).forEach(function (filePath, index) { | ||
if (index !== 0) { | ||
printed += ',\n'; | ||
} | ||
printed += " \"" + filePath + "\": [\n"; | ||
Object.keys(serialised) | ||
.sort() | ||
.forEach(function (filePath, index) { | ||
var file = " \"" + filePath + "\": [\n"; | ||
printed += prependNewline(index, file); | ||
serialised[filePath].forEach(function (mark, index) { | ||
if (index !== 0) { | ||
printed += ',\n'; | ||
} | ||
var line = mark[0], column = mark[1], length = mark[2], message = mark[3], hash = mark[4]; | ||
printed += " [" + line + ", " + column + ", " + length + ", " + JSON.stringify(message) + ", " + JSON.stringify(hash) + "]"; | ||
var issue = " [" + line + ", " + column + ", " + length + ", " + JSON.stringify(message) + ", " + JSON.stringify(hash) + "]"; | ||
printed += prependNewline(index, issue); | ||
}); | ||
@@ -25,2 +23,5 @@ printed += "\n ]"; | ||
exports.printer = printer; | ||
function prependNewline(index, str) { | ||
return "" + (index === 0 ? '' : ',\n') + str; | ||
} | ||
//# sourceMappingURL=printer.js.map |
{ | ||
"name": "@betterer/betterer", | ||
"description": "Main engine for runing betterer tests", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "7780911635fc418e46bb4b3f8c60eaf10578b710" | ||
"gitHead": "7f89d645814275abfa7d9099231de6132130e366" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158584
162
2368