Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@betterer/betterer

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betterer/betterer - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

19

dist/context/context.js

@@ -102,4 +102,10 @@ "use strict";

BettererContext.prototype.runStart = function (run) {
var _a, _b, _c;
(_c = (_b = (_a = this._reporters) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.call(_b, run);
var _a, _b, _c, _d, _e, _f;
assert(this._stats);
var isExpired = run.isExpired, name = run.name;
if (isExpired) {
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);
};

@@ -217,6 +223,11 @@ BettererContext.prototype.runBetter = function (run) {

return Object.keys(tests_1).map(function (name) {
var test = tests_1[name];
if (!test_1.isBettererTest(test)) {
var maybeTest = tests_1[name];
var test = null;
if (test_1.isBettererTest(maybeTest)) {
test = maybeTest;
}
else {
test = new test_1.BettererTest(tests_1[name]);
}
assert(test);
test.setName(name);

@@ -223,0 +234,0 @@ return test;

@@ -14,2 +14,4 @@ import { BettererExpectedResult, NO_PREVIOUS_RESULT } from '../results';

private _timestamp;
private _isComplete;
private _isExpired;
private _isNew;

@@ -25,2 +27,3 @@ private _hasResult;

get isComplete(): boolean;
get isExpired(): boolean;
get isFailed(): boolean;

@@ -40,3 +43,3 @@ get isNew(): boolean;

ran(): void;
start(): void;
start(): number;
same(): void;

@@ -43,0 +46,0 @@ skipped(): void;

@@ -9,9 +9,8 @@ "use strict";

BettererRunStatus[BettererRunStatus["better"] = 0] = "better";
BettererRunStatus[BettererRunStatus["complete"] = 1] = "complete";
BettererRunStatus[BettererRunStatus["failed"] = 2] = "failed";
BettererRunStatus[BettererRunStatus["pending"] = 3] = "pending";
BettererRunStatus[BettererRunStatus["neww"] = 4] = "neww";
BettererRunStatus[BettererRunStatus["same"] = 5] = "same";
BettererRunStatus[BettererRunStatus["skipped"] = 6] = "skipped";
BettererRunStatus[BettererRunStatus["worse"] = 7] = "worse";
BettererRunStatus[BettererRunStatus["failed"] = 1] = "failed";
BettererRunStatus[BettererRunStatus["pending"] = 2] = "pending";
BettererRunStatus[BettererRunStatus["neww"] = 3] = "neww";
BettererRunStatus[BettererRunStatus["same"] = 4] = "same";
BettererRunStatus[BettererRunStatus["skipped"] = 5] = "skipped";
BettererRunStatus[BettererRunStatus["worse"] = 6] = "worse";
})(BettererRunStatus || (BettererRunStatus = {}));

@@ -25,2 +24,4 @@ var BettererRun = /** @class */ (function () {

this._timestamp = null;
this._isComplete = false;
this._isExpired = false;
this._isNew = true;

@@ -70,4 +71,4 @@ this._hasResult = false;

get: function () {
assert.notEqual(this._status, BettererRunStatus.pending);
assert.notEqual(this._timestamp, null);
assert.notStrictEqual(this._status, BettererRunStatus.pending);
assert.notStrictEqual(this._timestamp, null);
return this._timestamp;

@@ -87,3 +88,3 @@ },

get: function () {
return this._status === BettererRunStatus.complete;
return this._isComplete;
},

@@ -93,2 +94,9 @@ enumerable: false,

});
Object.defineProperty(BettererRun.prototype, "isExpired", {
get: function () {
return this._isExpired;
},
enumerable: false,
configurable: true
});
Object.defineProperty(BettererRun.prototype, "isFailed", {

@@ -159,3 +167,4 @@ get: function () {

assert.equal(this._status, BettererRunStatus.pending);
this._status = isComplete ? BettererRunStatus.complete : BettererRunStatus.better;
this._status = BettererRunStatus.better;
this._isComplete = isComplete;
this._result = result;

@@ -177,3 +186,4 @@ this._toPrint = result;

assert.equal(this._status, BettererRunStatus.pending);
this._status = isComplete ? BettererRunStatus.complete : BettererRunStatus.neww;
this._status = BettererRunStatus.neww;
this._isComplete = isComplete;
this._result = result;

@@ -189,3 +199,6 @@ this._toPrint = result;

BettererRun.prototype.start = function () {
var startTime = Date.now();
this._isExpired = startTime > this._test.deadline;
this._context.runStart(this);
return startTime;
};

@@ -192,0 +205,0 @@ BettererRun.prototype.same = function () {

import { BettererTestNames } from './types';
export declare class BettererStats {
readonly obsolete: BettererTestNames;
readonly skipped: BettererTestNames;
readonly ran: BettererTestNames;
readonly better: BettererTestNames;
readonly completed: BettererTestNames;
readonly expired: BettererTestNames;
readonly failed: BettererTestNames;
readonly new: BettererTestNames;
readonly better: BettererTestNames;
readonly ran: BettererTestNames;
readonly same: BettererTestNames;
readonly obsolete: BettererTestNames;
readonly skipped: BettererTestNames;
readonly worse: BettererTestNames;
readonly completed: BettererTestNames;
}

@@ -6,11 +6,12 @@ "use strict";

function BettererStats() {
this.obsolete = [];
this.skipped = [];
this.ran = [];
this.better = [];
this.completed = [];
this.expired = [];
this.failed = [];
this.new = [];
this.better = [];
this.ran = [];
this.same = [];
this.obsolete = [];
this.skipped = [];
this.worse = [];
this.completed = [];
}

@@ -17,0 +18,0 @@ return BettererStats;

@@ -31,4 +31,9 @@ "use strict";

var skipped = stats.skipped.length;
var completed = stats.completed;
var completed = stats.completed, expired = stats.expired;
logger_1.info(ran + " " + getTests(ran) + " got checked. \uD83E\uDD14");
if (expired) {
expired.forEach(function (testName) {
logger_1.error("\"" + testName + "\" has passed its deadline. \u2620\uFE0F");
});
}
if (failed) {

@@ -35,0 +40,0 @@ logger_1.error(failed + " " + getTests(failed) + " failed to run. \uD83D\uDD25");

@@ -15,2 +15,5 @@ "use strict";

},
expired: function (run) {
logger_1.error("\"" + run.name + "\" has passed its deadline. \u2620\uFE0F");
},
failed: function (run) {

@@ -17,0 +20,0 @@ logger_1.error("\"" + run.name + "\" failed to run. \uD83D\uDD25");

@@ -21,2 +21,6 @@ "use strict";

}
if (run.isExpired) {
report += "\n \"" + name + "\" has passed its deadline. \u2620\uFE0F";
return;
}
if (run.isFailed) {

@@ -23,0 +27,0 @@ report += "\n \"" + run.name + "\" failed to run. \uD83D\uDD25";

@@ -15,2 +15,3 @@ import { BettererError } from '@betterer/errors';

better(run: BettererRun): void;
expired(run: BettererRun): void;
failed(run: BettererRun): void;

@@ -17,0 +18,0 @@ neww(run: BettererRun): void;

@@ -79,4 +79,3 @@ "use strict";

}
run.start();
timestamp = Date.now();
timestamp = run.start();
_a.label = 1;

@@ -83,0 +82,0 @@ case 1:

@@ -7,2 +7,3 @@ import { BettererTestOptions, BettererTestConstraint, BettererTestGoal, BettererTestFunction, BettererDiffer, BettererPrinter, BettererSerialiser } from './types';

readonly test: BettererTestFunction<DeserialisedType>;
readonly deadline: number;
differ?: BettererDiffer;

@@ -16,4 +17,5 @@ printer?: BettererPrinter<SerialisedType>;

get name(): string;
private _createDeadline;
private _createGoal;
}
export declare function isBettererTest(test: unknown): test is BettererTest;

@@ -24,2 +24,3 @@ "use strict";

_this.goal = _this._createGoal(options);
_this.deadline = _this._createDeadline(options);
_this.test = options.test;

@@ -36,3 +37,3 @@ _this.differ = options.differ;

get: function () {
assert.notEqual(this._name, null);
assert.notStrictEqual(this._name, null);
return this._name;

@@ -43,2 +44,10 @@ },

});
BettererTest.prototype._createDeadline = function (options) {
var deadline = options.deadline;
if (deadline == null) {
return 0;
}
var maybeDate = new Date(deadline).getTime();
return !isNaN(maybeDate) ? maybeDate : 0;
};
BettererTest.prototype._createGoal = function (options) {

@@ -45,0 +54,0 @@ var hasGoal = Object.hasOwnProperty.call(options, 'goal');

@@ -28,5 +28,6 @@ import { ConstraintResult } from '@betterer/constraints';

constraint: BettererTestConstraint<DeserialisedType>;
deadline?: Date | string;
goal?: DeserialisedType | BettererTestGoal<DeserialisedType>;
test: BettererTestFunction<DeserialisedType>;
} & BettererTestType<DeserialisedType, SerialisedType> & BettererTestStateOptions;
export declare type BettererTestMap = Record<string, BettererTest>;
export declare type BettererTestMap = Record<string, BettererTest | BettererTestOptions<unknown, unknown>>;
{
"name": "@betterer/betterer",
"description": "Main engine for runing betterer tests",
"version": "1.0.2",
"version": "1.1.0",
"license": "MIT",

@@ -40,3 +40,3 @@ "publishConfig": {

},
"gitHead": "db78ef726ff97b65fc4922acdf65a97e6aa7cc31"
"gitHead": "d676d340de650aeb2014bb6b01d224a4fbc43a1c"
}

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc