Comparing version 10.2.2 to 10.3.0
@@ -261,3 +261,3 @@ "use strict"; | ||
else { | ||
return require(cfgFile); | ||
return require(cfgFile); // eslint-disable-line no-undef | ||
} | ||
@@ -264,0 +264,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
{ exclude: /[\s]+/g, replaceWith: '_' }, | ||
{ exclude: /[\$\^\&\*\%\£\€\~\#\@\!\|\?\'\"\:\;\=\+\[\]\<\>]/g, replaceWith: '' } | ||
{ exclude: /[\$\^\&\*\%\£\€\~\#\@\!\|\?\'\"\:\;\=\+\[\]\<\>]/g, replaceWith: '' } // eslint-disable-line no-useless-escape | ||
]; | ||
@@ -29,3 +29,3 @@ })(SafeStringOption || (exports.SafeStringOption = SafeStringOption = {})); | ||
toBase64Encoded(input) { | ||
return Buffer.from(input).toString('base64'); | ||
return Buffer.from(input).toString('base64'); // eslint-disable-line no-undef | ||
} | ||
@@ -37,3 +37,3 @@ /** | ||
fromBase64Encoded(base64Str) { | ||
return Buffer.from(base64Str, 'base64').toString('ascii'); | ||
return Buffer.from(base64Str, 'base64').toString('ascii'); // eslint-disable-line no-undef | ||
} | ||
@@ -40,0 +40,0 @@ /** |
@@ -49,3 +49,3 @@ "use strict"; | ||
this._lockFileDescriptor = this._waitForLock(); | ||
this._timeout = setTimeout(() => (0, fs_ext_1.flockSync)(this._lockFileDescriptor, 'un'), this.lockDuration); | ||
this._timeout = setTimeout(() => (0, fs_ext_1.flockSync)(this._lockFileDescriptor, 'un'), this.lockDuration); // eslint-disable-line no-undef | ||
} | ||
@@ -57,3 +57,3 @@ /** | ||
unlock() { | ||
clearTimeout(this._timeout); | ||
clearTimeout(this._timeout); // eslint-disable-line no-undef | ||
(0, fs_ext_1.flockSync)(this._lockFileDescriptor, 'un'); | ||
@@ -60,0 +60,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fileio = void 0; | ||
const process = require("process"); | ||
const fs = require("fs"); | ||
@@ -5,0 +6,0 @@ const path = require("path"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileSystemMap = void 0; | ||
const process = require("process"); | ||
const path = require("path"); | ||
@@ -5,0 +6,0 @@ const convert_1 = require("./convert"); |
@@ -21,3 +21,3 @@ "use strict"; | ||
return new Promise((resolve) => { | ||
setTimeout(resolve, durationMs); | ||
setTimeout(resolve, durationMs); // eslint-disable-line no-undef | ||
}); | ||
@@ -37,3 +37,3 @@ }); | ||
Promise.resolve().then(func).catch((err) => Promise.reject(err)), | ||
new Promise((resolve) => setTimeout(resolve, maxDurationMs, undefined)) | ||
new Promise((resolve) => setTimeout(resolve, maxDurationMs, undefined)) // eslint-disable-line no-undef | ||
]); | ||
@@ -40,0 +40,0 @@ }); |
@@ -145,4 +145,5 @@ "use strict"; | ||
_logMessage(status, message) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
message = message || this.reporter.reporterName; | ||
message = (_b = message !== null && message !== void 0 ? message : (_a = this.reporter) === null || _a === void 0 ? void 0 : _a.reporterName) !== null && _b !== void 0 ? _b : 'unknown'; | ||
switch (status) { | ||
@@ -149,0 +150,0 @@ case 'blocked': |
@@ -15,3 +15,3 @@ "use strict"; | ||
static parseTestIds(title) { | ||
return this._parseAll(title, /\[([^\[\]]+)\]/gi); | ||
return this._parseAll(title, /\[([^\[\]]+)\]/gi); // eslint-disable-line no-useless-escape | ||
} | ||
@@ -18,0 +18,0 @@ static _parseAll(input, regex) { |
@@ -46,6 +46,4 @@ import { AftConfig } from "../configuration/aft-config"; | ||
* to the `message` | ||
* @param name the name of the system performing the log call | ||
* @param level the `LogLevel` of this message | ||
* @param message the string to be logged | ||
* @param data an array of additional data to be included in the logs | ||
* @param data a `LogMessageData` object containing details of the log message, level, name | ||
* and any additional arguments to be logged | ||
*/ | ||
@@ -52,0 +50,0 @@ log(data: LogMessageData): void; |
@@ -54,6 +54,4 @@ "use strict"; | ||
* to the `message` | ||
* @param name the name of the system performing the log call | ||
* @param level the `LogLevel` of this message | ||
* @param message the string to be logged | ||
* @param data an array of additional data to be included in the logs | ||
* @param data a `LogMessageData` object containing details of the log message, level, name | ||
* and any additional arguments to be logged | ||
*/ | ||
@@ -75,3 +73,3 @@ log(data) { | ||
format(data) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
data !== null && data !== void 0 ? data : (data = {}); | ||
@@ -82,3 +80,11 @@ (_a = data.name) !== null && _a !== void 0 ? _a : (data.name = 'AFT'); | ||
const d = new Date().toLocaleTimeString(); | ||
const out = `${d} - [${data.name}] - ${(0, ellide_1.ellide)(data.level.toUpperCase(), 5, 'end', '')} - ${data.message}`; | ||
const args = ((_d = data.args) === null || _d === void 0 ? void 0 : _d.length) ? `, [${data.args.map(d => { | ||
try { | ||
return JSON.stringify(d); | ||
} | ||
catch (_a) { | ||
return d === null || d === void 0 ? void 0 : d.toString(); | ||
} | ||
}).join(',')}]` : ''; | ||
const out = `${d} - [${data.name}] - ${(0, ellide_1.ellide)(data.level.toUpperCase(), 5, 'end', '')} - ${data.message}${args}`; | ||
return out; | ||
@@ -99,22 +105,22 @@ } | ||
case 'fail': | ||
console.log(colors.red(message)); | ||
console.log(colors.red(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'warn': | ||
console.log(colors.yellow(message)); | ||
console.log(colors.yellow(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'info': | ||
console.log(colors.white(message)); | ||
console.log(colors.white(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'pass': | ||
console.log(colors.green(message)); | ||
console.log(colors.green(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'step': | ||
console.log(colors.magenta(message)); | ||
console.log(colors.magenta(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'trace': | ||
case 'debug': | ||
console.log(colors.blue(message)); | ||
console.log(colors.blue(message)); // eslint-disable-line no-undef | ||
break; | ||
default: | ||
console.log(colors.gray(message)); | ||
console.log(colors.gray(message)); // eslint-disable-line no-undef | ||
break; | ||
@@ -121,0 +127,0 @@ } |
@@ -22,3 +22,3 @@ "use strict"; | ||
constructor(aftCfg) { | ||
this._safeStrOpt = [{ exclude: /[\()\;\\\/\|\<\>""'*&^%$#@!,.\-\+_=\?]/gi, replaceWith: '' }]; | ||
this._safeStrOpt = [{ exclude: /[\()\;\\\/\|\<\>""'*&^%$#@!,.\-\+_=\?]/gi, replaceWith: '' }]; // eslint-disable-line no-useless-escape | ||
this.aftCfg = aftCfg !== null && aftCfg !== void 0 ? aftCfg : aft_config_1.aftConfig; | ||
@@ -25,0 +25,0 @@ this._aftLogger = (aftCfg) ? new aft_logger_1.AftLogger(aftCfg) : aft_logger_1.aftLogger; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BuildInfoPlugin = void 0; | ||
const plugin_1 = require("../plugin"); | ||
const plugin_1 = require("../plugin"); // eslint-disable-line no-redeclare | ||
class BuildInfoPlugin extends plugin_1.Plugin { | ||
@@ -6,0 +6,0 @@ constructor() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pluginLoader = void 0; | ||
const process = require("process"); | ||
const fs = require("fs"); | ||
@@ -93,5 +94,5 @@ const path = require("path"); | ||
try { | ||
pathToPlugin = this._findPlugin(searchRoot, new RegExp(`^${pluginName}\.js$`)); | ||
pathToPlugin = this._findPlugin(searchRoot, new RegExp(`^${pluginName}\.js$`)); // eslint-disable-line no-useless-escape | ||
if (pathToPlugin) { | ||
plugin = require(pathToPlugin); | ||
plugin = require(pathToPlugin); // eslint-disable-line no-undef | ||
} | ||
@@ -98,0 +99,0 @@ else { |
@@ -33,2 +33,3 @@ import { Plugin, PluginConfig } from "../plugin"; | ||
* @param message the `LogMessageData` to be logged by this plugin | ||
* @param data an array of additional data to log | ||
*/ | ||
@@ -35,0 +36,0 @@ log: (name: string, level: LogLevel, message: string, ...data: any[]) => Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ReportingPlugin = exports.ReportingPluginConfig = void 0; | ||
const plugin_1 = require("../plugin"); | ||
const plugin_1 = require("../plugin"); // eslint-disable-line no-redeclare | ||
class ReportingPluginConfig extends plugin_1.PluginConfig { | ||
@@ -16,8 +16,9 @@ } | ||
*/ | ||
this.initialise = (logName) => null; | ||
this.initialise = (logName) => null; // eslint-disable-line no-unused-vars | ||
/** | ||
* used for reporting message strings. this function would be called often | ||
* @param message the `LogMessageData` to be logged by this plugin | ||
* @param data an array of additional data to log | ||
*/ | ||
this.log = (name, level, message, ...data) => null; | ||
this.log = (name, level, message, ...data) => null; // eslint-disable-line no-unused-vars | ||
/** | ||
@@ -27,3 +28,3 @@ * function will report on the passed in `TestResult` | ||
*/ | ||
this.submitResult = (name, result) => null; | ||
this.submitResult = (name, result) => null; // eslint-disable-line no-unused-vars | ||
/** | ||
@@ -34,3 +35,3 @@ * called by the parent `Reporter` before terminating to allow each plugin to | ||
*/ | ||
this.finalise = (name) => null; | ||
this.finalise = (name) => null; // eslint-disable-line no-unused-vars | ||
} | ||
@@ -37,0 +38,0 @@ get enabled() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TestExecutionPolicyPlugin = void 0; | ||
const plugin_1 = require("../plugin"); | ||
const plugin_1 = require("../plugin"); // eslint-disable-line no-redeclare | ||
class TestExecutionPolicyPlugin extends plugin_1.Plugin { | ||
constructor() { | ||
super(...arguments); | ||
this.shouldRun = (testId) => null; | ||
this.shouldRun = (testId) => null; // eslint-disable-line no-unused-vars | ||
} | ||
@@ -10,0 +10,0 @@ } |
@@ -224,7 +224,12 @@ "use strict"; | ||
let _actualStr; | ||
if (this._actual['has'] && this._actual['clear'] && this._actual['size'] !== undefined) { | ||
_actualStr = Array.from(this._actual).join(', '); | ||
if (typeof this._actual === "string") { | ||
_actualStr = this._actual; | ||
} | ||
if (Array.isArray(this._actual)) { | ||
_actualStr = this._actual.join(', '); | ||
else { | ||
if (this._actual['has'] && this._actual['clear'] && this._actual['size'] !== undefined) { | ||
_actualStr = Array.from(this._actual).join(', '); | ||
} | ||
if (Array.isArray(this._actual)) { | ||
_actualStr = this._actual.join(', '); | ||
} | ||
} | ||
@@ -231,0 +236,0 @@ return `expected '${this.expected}' to be contained in [${_actualStr}]`; |
@@ -52,3 +52,4 @@ import { Reporter } from "../plugins/reporting/reporter"; | ||
get buildInfoMgr(): BuildInfoManager; | ||
then<TResult1 = Verifier, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; | ||
then<TResult1 = Verifier, TResult2 = never>(onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, // eslint-disable-line no-unused-vars | ||
onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>; | ||
protected _getInnerPromise(): Promise<void>; | ||
@@ -55,0 +56,0 @@ protected _resolveAssertion(): Promise<void>; |
@@ -85,3 +85,4 @@ "use strict"; | ||
} | ||
then(onfulfilled, onrejected) { | ||
then(onfulfilled, // eslint-disable-line no-unused-vars | ||
onrejected) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -98,2 +99,3 @@ return this._getInnerPromise() | ||
const shouldRun = yield this.shouldRun(); | ||
yield this.reporter.debug('verifier.shouldRun response:', shouldRun); | ||
if (shouldRun.result === true) { | ||
@@ -103,3 +105,3 @@ const action = this._actionMap.get('started'); | ||
err_1.Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -116,3 +118,3 @@ }); | ||
err_1.Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -133,3 +135,3 @@ }); | ||
err_1.Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -136,0 +138,0 @@ }); |
@@ -11,3 +11,6 @@ { | ||
"random": true | ||
} | ||
}, | ||
"helpers": [ | ||
"../jasmine-typescript-helper.js" | ||
] | ||
} |
{ | ||
"name": "aft-core", | ||
"version": "10.2.2", | ||
"version": "10.3.0", | ||
"description": "Automation Framework for Testing (AFT) package supporting JavaScript unit, integration and functional testing", | ||
@@ -13,5 +13,6 @@ "repository": { | ||
"clean": "rimraf ./dist && rimraf ./.nyc_output && rimraf ./coverage", | ||
"build": "npm run clean && tsc --build", | ||
"test": "npm run build && npx jasmine-ts --config=./jasmine.json", | ||
"coverage": "npm run build && nyc npx jasmine-ts --config=./jasmine.json" | ||
"build": "npm run lint && npm run clean && tsc --build", | ||
"lint": "npx eslint --fix ./src --ext .ts", | ||
"test": "npm run build && npx jasmine --config=./jasmine.json", | ||
"coverage": "npm run build && nyc npx jasmine --config=./jasmine.json" | ||
}, | ||
@@ -34,21 +35,23 @@ "keywords": [ | ||
"colors": "^1.4.0", | ||
"dotenv": "^16.3.1", | ||
"dotenv": "^16.4.5", | ||
"fs-ext": "^2.0.0", | ||
"lodash": "^4.17.21", | ||
"uuid": "^9.0.0" | ||
"uuid": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-ext": "^2.0.0", | ||
"@types/jasmine": "^4.3.5", | ||
"@types/node": "^20.4.1", | ||
"@types/uuid": "^9.0.2", | ||
"jasmine": "^5.0.2", | ||
"jasmine-ts": "^0.4.0", | ||
"@types/fs-ext": "^2.0.3", | ||
"@types/jasmine": "^4.6.4", | ||
"@types/node": "^20.11.30", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^7.4.0", | ||
"@typescript-eslint/parser": "^7.4.0", | ||
"eslint": "^8.57.0", | ||
"jasmine": "^5.1.0", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^5.0.1", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^10.9.1", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.1.6" | ||
}, | ||
"gitHead": "19feb690f258fe10c7e8b43425ff22e91650602a" | ||
"gitHead": "03941230bb27da6b0c3cbea64aed963335932e09" | ||
} |
@@ -272,3 +272,3 @@ import * as fs from 'fs'; | ||
} else { | ||
return require(cfgFile) as JsonObject; | ||
return require(cfgFile) as JsonObject; // eslint-disable-line no-undef | ||
} | ||
@@ -275,0 +275,0 @@ } catch { |
@@ -34,3 +34,3 @@ import { JsonKey, JsonValue, CacheObject } from "./custom-types"; | ||
} | ||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void { | ||
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void { // eslint-disable-line no-unused-vars | ||
const valMap: Map<K, V> = new Map<K, V>(); | ||
@@ -37,0 +37,0 @@ const keys: K[] = Array.from(this._internalMap.keys()); |
@@ -23,3 +23,3 @@ import { JsonObject } from "./custom-types"; | ||
*/ | ||
export module SafeStringOption { | ||
export module SafeStringOption { // eslint-disable-line no-redeclare | ||
/** | ||
@@ -32,5 +32,5 @@ * a default set of characters to exclude and their replacement values that prevents | ||
export const defaults: SafeStringOption[] = [ | ||
{exclude: /[\/\\\{\}\(\)\,\.\-]/g, replaceWith: '_'}, | ||
{exclude: /[\/\\\{\}\(\)\,\.\-]/g, replaceWith: '_'}, // eslint-disable-line no-useless-escape | ||
{exclude: /[\s]+/g, replaceWith: '_'}, | ||
{exclude: /[\$\^\&\*\%\£\€\~\#\@\!\|\?\'\"\:\;\=\+\[\]\<\>]/g, replaceWith: ''} | ||
{exclude: /[\$\^\&\*\%\£\€\~\#\@\!\|\?\'\"\:\;\=\+\[\]\<\>]/g, replaceWith: ''} // eslint-disable-line no-useless-escape | ||
]; | ||
@@ -45,3 +45,3 @@ } | ||
toBase64Encoded(input: string) { | ||
return Buffer.from(input).toString('base64'); | ||
return Buffer.from(input).toString('base64'); // eslint-disable-line no-undef | ||
} | ||
@@ -54,3 +54,3 @@ | ||
fromBase64Encoded(base64Str: string) { | ||
return Buffer.from(base64Str, 'base64').toString('ascii'); | ||
return Buffer.from(base64Str, 'base64').toString('ascii'); // eslint-disable-line no-undef | ||
} | ||
@@ -57,0 +57,0 @@ |
@@ -9,3 +9,3 @@ /** | ||
export type Action<T> = { | ||
(item: T): void; | ||
(item: T): void; // eslint-disable-line no-unused-vars | ||
}; | ||
@@ -38,3 +38,3 @@ | ||
export type Class<T> = { | ||
new (...args: any[]): T; | ||
new (...args: any[]): T; // eslint-disable-line no-unused-vars | ||
readonly prototype: T; | ||
@@ -51,3 +51,3 @@ }; | ||
*/ | ||
export type Func<T, TResult> = (x: T) => TResult; | ||
export type Func<T, TResult> = (x: T) => TResult; // eslint-disable-line no-unused-vars | ||
@@ -54,0 +54,0 @@ /** |
@@ -156,3 +156,3 @@ import { LogLevel } from '../logging/log-level'; | ||
export module Err { | ||
export module Err { // eslint-disable-line no-redeclare | ||
/** | ||
@@ -159,0 +159,0 @@ * @param err the `Error` to parse |
@@ -43,3 +43,3 @@ import * as fs from "fs"; | ||
private readonly _lockFileDescriptor: number; | ||
private readonly _timeout: NodeJS.Timeout; | ||
private readonly _timeout: NodeJS.Timeout; // eslint-disable-line no-undef | ||
@@ -55,3 +55,3 @@ constructor(lockFileName: string, aftCfg?: AftConfig) { | ||
this._lockFileDescriptor = this._waitForLock(); | ||
this._timeout = setTimeout(() => flockSync(this._lockFileDescriptor, 'un'), this.lockDuration); | ||
this._timeout = setTimeout(() => flockSync(this._lockFileDescriptor, 'un'), this.lockDuration); // eslint-disable-line no-undef | ||
} | ||
@@ -64,3 +64,3 @@ | ||
unlock(): void { | ||
clearTimeout(this._timeout); | ||
clearTimeout(this._timeout); // eslint-disable-line no-undef | ||
flockSync(this._lockFileDescriptor, 'un'); | ||
@@ -97,3 +97,3 @@ } | ||
export module ExpiringFileLock { | ||
export module ExpiringFileLock { // eslint-disable-line no-redeclare | ||
/** | ||
@@ -100,0 +100,0 @@ * creates a new {ExpiringFileLock} that can be used to ensure separate processes cannot cause |
@@ -0,1 +1,2 @@ | ||
import process = require("process"); | ||
import * as fs from "fs"; | ||
@@ -2,0 +3,0 @@ import * as path from "path"; |
@@ -0,1 +1,2 @@ | ||
import process = require("process"); | ||
import * as path from "path"; | ||
@@ -55,3 +56,3 @@ import { convert } from "./convert"; | ||
} | ||
forEach(callbackfn: (value: Tval, key: Tkey, map: Map<Tkey, Tval>) => void, thisArg?: any): void { | ||
forEach(callbackfn: (value: Tval, key: Tkey, map: Map<Tkey, Tval>) => void, thisArg?: any): void { // eslint-disable-line no-unused-vars | ||
this._updateMemoryMap(); | ||
@@ -58,0 +59,0 @@ this._memoryMap.forEach(callbackfn, thisArg); |
@@ -145,3 +145,3 @@ import { AftConfig, aftConfig } from "../configuration/aft-config"; | ||
async then<TResult1, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> { | ||
async then<TResult1, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> { // eslint-disable-line no-unused-vars | ||
if (this._maxDuration < Infinity) { | ||
@@ -148,0 +148,0 @@ return wait.forResult(() => this._getInnerPromise(), this._maxDuration) |
@@ -19,3 +19,3 @@ import { Func } from "./custom-types"; | ||
export interface Disposable { | ||
dispose(error?: any): void; | ||
dispose(error?: any): void; // eslint-disable-line no-unused-vars | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -10,3 +10,3 @@ import { Func } from "./custom-types"; | ||
return new Promise((resolve) => { | ||
setTimeout(resolve, durationMs); | ||
setTimeout(resolve, durationMs); // eslint-disable-line no-undef | ||
}); | ||
@@ -25,3 +25,3 @@ } | ||
Promise.resolve().then(func).catch((err) => Promise.reject(err)), | ||
new Promise<T>((resolve) => setTimeout(resolve, maxDurationMs, undefined)) | ||
new Promise<T>((resolve) => setTimeout(resolve, maxDurationMs, undefined)) // eslint-disable-line no-undef | ||
]); | ||
@@ -42,3 +42,3 @@ } | ||
} | ||
return new Promise(async (resolve) => { | ||
return new Promise(async (resolve) => { // eslint-disable-line no-async-promise-executor | ||
while (Date.now() < t) { | ||
@@ -45,0 +45,0 @@ await wait.forDuration(1); |
@@ -144,3 +144,3 @@ import { AftConfig, aftConfig } from "../configuration/aft-config"; | ||
protected async _logMessage(status: TestStatus, message?: string): Promise<void> { | ||
message = message || this.reporter.reporterName; | ||
message = message ?? this.reporter?.reporterName ?? 'unknown'; | ||
switch (status) { | ||
@@ -147,0 +147,0 @@ case 'blocked': |
@@ -12,3 +12,3 @@ export class TitleParser { | ||
static parseTestIds(title: string): Array<string> { | ||
return this._parseAll(title, /\[([^\[\]]+)\]/gi); | ||
return this._parseAll(title, /\[([^\[\]]+)\]/gi); // eslint-disable-line no-useless-escape | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -56,6 +56,4 @@ import * as colors from "colors"; | ||
* to the `message` | ||
* @param name the name of the system performing the log call | ||
* @param level the `LogLevel` of this message | ||
* @param message the string to be logged | ||
* @param data an array of additional data to be included in the logs | ||
* @param data a `LogMessageData` object containing details of the log message, level, name | ||
* and any additional arguments to be logged | ||
*/ | ||
@@ -83,3 +81,10 @@ log(data: LogMessageData): void { | ||
const d: string = new Date().toLocaleTimeString(); | ||
const out = `${d} - [${data.name}] - ${ellide(data.level.toUpperCase(), 5, 'end', '')} - ${data.message}`; | ||
const args: string = (data.args?.length) ? `, [${data.args.map(d => { | ||
try { | ||
return JSON.stringify(d); | ||
} catch { | ||
return d?.toString(); | ||
} | ||
}).join(',')}]` : ''; | ||
const out = `${d} - [${data.name}] - ${ellide(data.level.toUpperCase(), 5, 'end', '')} - ${data.message}${args}`; | ||
return out; | ||
@@ -101,22 +106,22 @@ } | ||
case 'fail': | ||
console.log(colors.red(message)); | ||
console.log(colors.red(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'warn': | ||
console.log(colors.yellow(message)); | ||
console.log(colors.yellow(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'info': | ||
console.log(colors.white(message)); | ||
console.log(colors.white(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'pass': | ||
console.log(colors.green(message)); | ||
console.log(colors.green(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'step': | ||
console.log(colors.magenta(message)); | ||
console.log(colors.magenta(message)); // eslint-disable-line no-undef | ||
break; | ||
case 'trace': | ||
case 'debug': | ||
console.log(colors.blue(message)); | ||
console.log(colors.blue(message)); // eslint-disable-line no-undef | ||
break; | ||
default: | ||
console.log(colors.gray(message)); | ||
console.log(colors.gray(message)); // eslint-disable-line no-undef | ||
break; | ||
@@ -123,0 +128,0 @@ } |
@@ -18,3 +18,3 @@ const levels = ['trace', 'debug', 'info', 'step', 'warn', 'pass', 'fail', 'error', 'none'] as const; | ||
*/ | ||
export module LogLevel { | ||
export module LogLevel { // eslint-disable-line no-redeclare | ||
/** | ||
@@ -21,0 +21,0 @@ * indicates whether a value is a valid `LogLevel` or not |
@@ -13,3 +13,3 @@ import { AftConfig, aftConfig } from "../../configuration/aft-config"; | ||
private readonly _safeStrOpt: SafeStringOption[] = [{exclude: /[\()\;\\\/\|\<\>""'*&^%$#@!,.\-\+_=\?]/gi, replaceWith: ''}]; | ||
private readonly _safeStrOpt: SafeStringOption[] = [{exclude: /[\()\;\\\/\|\<\>""'*&^%$#@!,.\-\+_=\?]/gi, replaceWith: ''}]; // eslint-disable-line no-useless-escape | ||
private readonly _aftLogger: AftLogger; | ||
@@ -16,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Plugin } from "../plugin"; | ||
import { Plugin } from "../plugin"; // eslint-disable-line no-redeclare | ||
@@ -3,0 +3,0 @@ export class BuildInfoPlugin extends Plugin { |
@@ -0,5 +1,6 @@ | ||
import process = require('process'); | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import { convert } from '../helpers/convert'; | ||
import { Plugin } from './plugin'; | ||
import { Plugin } from './plugin'; // eslint-disable-line no-redeclare | ||
import { AftConfig, aftConfig } from '../configuration/aft-config'; | ||
@@ -100,5 +101,5 @@ import { Class } from '../helpers/custom-types'; | ||
try { | ||
pathToPlugin = this._findPlugin(searchRoot, new RegExp(`^${pluginName}\.js$`)); | ||
pathToPlugin = this._findPlugin(searchRoot, new RegExp(`^${pluginName}\.js$`)); // eslint-disable-line no-useless-escape | ||
if (pathToPlugin) { | ||
plugin = require(pathToPlugin); | ||
plugin = require(pathToPlugin); // eslint-disable-line no-undef | ||
} else { | ||
@@ -105,0 +106,0 @@ throw new Error(`plugin could not be located`); |
@@ -11,3 +11,3 @@ import { AftConfig, aftConfig } from "../configuration/aft-config"; | ||
*/ | ||
export class Plugin { | ||
export class Plugin { // eslint-disable-line no-redeclare | ||
private readonly _aftCfg: AftConfig; | ||
@@ -14,0 +14,0 @@ private readonly _aftLogger: AftLogger; |
@@ -1,2 +0,2 @@ | ||
import { Plugin, PluginConfig } from "../plugin"; | ||
import { Plugin, PluginConfig } from "../plugin"; // eslint-disable-line no-redeclare | ||
import { LogLevel } from "../../logging/log-level"; | ||
@@ -35,8 +35,9 @@ import { TestResult } from "./test-result"; | ||
*/ | ||
initialise = (logName: string): Promise<void> => null; | ||
initialise = (logName: string): Promise<void> => null; // eslint-disable-line no-unused-vars | ||
/** | ||
* used for reporting message strings. this function would be called often | ||
* @param message the `LogMessageData` to be logged by this plugin | ||
* @param data an array of additional data to log | ||
*/ | ||
log = (name: string, level: LogLevel, message: string, ...data: any[]): Promise<void> => null; | ||
log = (name: string, level: LogLevel, message: string, ...data: any[]): Promise<void> => null; // eslint-disable-line no-unused-vars | ||
/** | ||
@@ -46,3 +47,3 @@ * function will report on the passed in `TestResult` | ||
*/ | ||
submitResult = (name: string, result: TestResult): Promise<void> => null; | ||
submitResult = (name: string, result: TestResult): Promise<void> => null; // eslint-disable-line no-unused-vars | ||
/** | ||
@@ -53,3 +54,3 @@ * called by the parent `Reporter` before terminating to allow each plugin to | ||
*/ | ||
finalise = (name: string): Promise<void> => null; | ||
finalise = (name: string): Promise<void> => null; // eslint-disable-line no-unused-vars | ||
} |
import { ProcessingResult } from "../../helpers/custom-types"; | ||
import { Plugin } from "../plugin"; | ||
import { Plugin } from "../plugin"; // eslint-disable-line no-redeclare | ||
export class TestExecutionPolicyPlugin extends Plugin { | ||
shouldRun = (testId: string): Promise<ProcessingResult<boolean>> => null; | ||
shouldRun = (testId: string): Promise<ProcessingResult<boolean>> => null; // eslint-disable-line no-unused-vars | ||
} |
@@ -8,6 +8,6 @@ import { AftConfig } from "../configuration/aft-config"; | ||
export type VerifierInternals = { | ||
usingAftConfig: (cfg: AftConfig) => Verifier, | ||
usingBuildInfoManager: (mgr: BuildInfoManager) => Verifier, | ||
usingReporter: (mgr: Reporter) => Verifier, | ||
usingTestExecutionPolicyManager: (mgr: TestExecutionPolicyManager) => Verifier | ||
usingAftConfig: (cfg: AftConfig) => Verifier, // eslint-disable-line no-unused-vars | ||
usingBuildInfoManager: (mgr: BuildInfoManager) => Verifier, // eslint-disable-line no-unused-vars | ||
usingReporter: (mgr: Reporter) => Verifier, // eslint-disable-line no-unused-vars | ||
usingTestExecutionPolicyManager: (mgr: TestExecutionPolicyManager) => Verifier // eslint-disable-line no-unused-vars | ||
} |
export interface VerifierMatcher { | ||
readonly expected: any; | ||
setActual(actual: any): VerifierMatcher; | ||
setActual(actual: any): VerifierMatcher; // eslint-disable-line no-unused-vars | ||
compare(): boolean; | ||
@@ -241,8 +241,12 @@ failureString(): string; | ||
let _actualStr: string; | ||
if (this._actual['has'] && this._actual['clear'] && this._actual['size'] !== undefined) { | ||
_actualStr = Array.from(this._actual).join(', '); | ||
if (typeof this._actual === "string") { | ||
_actualStr = this._actual; | ||
} else { | ||
if (this._actual['has'] && this._actual['clear'] && this._actual['size'] !== undefined) { | ||
_actualStr = Array.from(this._actual).join(', '); | ||
} | ||
if (Array.isArray(this._actual)) { | ||
_actualStr = this._actual.join(', '); | ||
} | ||
} | ||
if (Array.isArray(this._actual)) { | ||
_actualStr = this._actual.join(', '); | ||
} | ||
return `expected '${this.expected}' to be contained in [${_actualStr}]`; | ||
@@ -249,0 +253,0 @@ } |
@@ -96,4 +96,4 @@ import { Reporter } from "../plugins/reporting/reporter"; | ||
async then<TResult1 = Verifier, TResult2 = never>( | ||
onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, | ||
onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> { | ||
onfulfilled?: (value: void) => TResult1 | PromiseLike<TResult1>, // eslint-disable-line no-unused-vars | ||
onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2> { // eslint-disable-line no-unused-vars | ||
return this._getInnerPromise() | ||
@@ -105,5 +105,6 @@ .then(onfulfilled, onrejected); | ||
if (!this._innerPromise) { | ||
this._innerPromise = new Promise(async (resolve, reject) => { | ||
this._innerPromise = new Promise(async (resolve, reject) => { // eslint-disable-line no-async-promise-executor | ||
try { | ||
const shouldRun = await this.shouldRun(); | ||
await this.reporter.debug('verifier.shouldRun response:', shouldRun); | ||
if (shouldRun.result === true) { | ||
@@ -113,3 +114,3 @@ const action = this._actionMap.get('started'); | ||
Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -125,3 +126,3 @@ }); | ||
Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -141,3 +142,3 @@ }); | ||
Err.handle(() => action(), { | ||
errLevel: 'warn', | ||
errLevel: 'debug', | ||
logger: this.reporter | ||
@@ -144,0 +145,0 @@ }); |
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
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
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
860610
261
13080
13
Updateddotenv@^16.4.5
Updateduuid@^9.0.1