@bitdiver/model
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -1,21 +0,16 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _uuid = _interopRequireDefault(require("uuid")); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _status = require("./status"); | ||
var _uuid = require('uuid'); | ||
const uuidV4 = _uuid.default.v4; | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
var _status = require('./status'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const uuidV4 = _uuid2.default.v4; | ||
/** | ||
@@ -28,19 +23,13 @@ * The run enviroment will be created when a new run starts | ||
// The run id | ||
this.id = uuidV4(); | ||
this.id = uuidV4(); // The name of the suite | ||
// The name of the suite | ||
this.name = opts.name; | ||
this.name = opts.name; // The status of the complete run | ||
// The status of the complete run | ||
this._status = _status.STATUS_OK; | ||
this._status = _status.STATUS_OK; // The description of the suite | ||
// The description of the suite | ||
this.description = opts.description; | ||
this.startTime = Date.now(); // The map is used to store the data | ||
this.startTime = Date.now(); | ||
// The map is used to store the data | ||
this.map = new _map2.default(); | ||
this.map = new Map(); | ||
} | ||
/** | ||
@@ -51,2 +40,4 @@ * The status could only be changed while the testcase is running. After finishing the | ||
*/ | ||
set status(newStatus) { | ||
@@ -61,3 +52,5 @@ if (newStatus > this._status) { | ||
} | ||
} | ||
exports.default = EnvironmentRun; |
@@ -1,21 +0,16 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _uuid = _interopRequireDefault(require("uuid")); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _status = require("./status"); | ||
var _uuid = require('uuid'); | ||
const uuidV4 = _uuid.default.v4; | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
var _status = require('./status'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const uuidV4 = _uuid2.default.v4; | ||
/** | ||
@@ -29,26 +24,18 @@ * The testcase enviroment will be created when the test starts. There is one testcase | ||
// The testcase instance id | ||
this.id = uuidV4(); | ||
this.id = uuidV4(); // The name of this testcasde | ||
// The name of this testcasde | ||
this.name = opts.name; | ||
this.name = opts.name; // a description for this test case | ||
// a description for this test case | ||
this.description = opts.description; | ||
this._status = _status.STATUS_OK; // if the running is false, the status could not be changed any more | ||
this._status = _status.STATUS_OK; | ||
this.running = true; // The map is used to store the data | ||
// if the running is false, the status could not be changed any more | ||
this.running = true; | ||
this.map = new Map(); // This is set by the runner. The number of this test case in the list of all the test cases | ||
// Start with '1' | ||
// The map is used to store the data | ||
this.map = new _map2.default(); | ||
this.countCurrent = 0; // This is set by the runner. How many test cases to be excuted in this run | ||
// This is set by the runner. The number of this test case in the list of all the test cases | ||
// Start with '1' | ||
this.countCurrent = 0; | ||
// This is set by the runner. How many test cases to be excuted in this run | ||
this.countAll = 0; | ||
} | ||
/** | ||
@@ -59,2 +46,4 @@ * The status could only be changed while the testcase is running. After finishing the | ||
*/ | ||
set status(newStatus) { | ||
@@ -65,13 +54,17 @@ if (this.running && newStatus > this._status) { | ||
} | ||
get status() { | ||
return this._status; | ||
} | ||
/** | ||
* Finishes this testcase | ||
*/ | ||
finished() { | ||
this.running = false; | ||
} | ||
} | ||
exports.default = EnvironmentTestcase; |
141
lib/index.js
@@ -1,56 +0,105 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.generateLogs = exports.DIR_BASE_DATA = exports.LEVEL_FATAL = exports.LEVEL_ERROR = exports.LEVEL_WARNING = exports.LEVEL_INFO = exports.LEVEL_DEBUG = exports.STEP_TYPE_SERVER_ONLY = exports.STEP_TYPE_SINGLE = exports.STEP_TYPE_NORMAL = exports.STATUS_FATAL = exports.STATUS_ERROR = exports.STATUS_WARNING = exports.STATUS_UNKNOWN = exports.STATUS_OK = exports.StepRegistry = exports.StepBase = exports.getLogAdapterMemory = exports.getLogAdapter = exports.LogAdapterMemory = exports.LogAdapter = exports.EnvironmentTestcase = exports.EnvironmentRun = undefined; | ||
Object.defineProperty(exports, "EnvironmentRun", { | ||
enumerable: true, | ||
get: function () { | ||
return _EnvironmentRun.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "EnvironmentTestcase", { | ||
enumerable: true, | ||
get: function () { | ||
return _EnvironmentTestcase.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "StepBase", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepBase.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STEP_TYPE_NORMAL", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepBase.STEP_TYPE_NORMAL; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STEP_TYPE_SINGLE", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepBase.STEP_TYPE_SINGLE; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STEP_TYPE_SERVER_ONLY", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepBase.STEP_TYPE_SERVER_ONLY; | ||
} | ||
}); | ||
Object.defineProperty(exports, "DIR_BASE_DATA", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepBase.DIR_BASE_DATA; | ||
} | ||
}); | ||
Object.defineProperty(exports, "StepRegistry", { | ||
enumerable: true, | ||
get: function () { | ||
return _StepRegistry.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STATUS_OK", { | ||
enumerable: true, | ||
get: function () { | ||
return _status.STATUS_OK; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STATUS_UNKNOWN", { | ||
enumerable: true, | ||
get: function () { | ||
return _status.STATUS_UNKNOWN; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STATUS_WARNING", { | ||
enumerable: true, | ||
get: function () { | ||
return _status.STATUS_WARNING; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STATUS_ERROR", { | ||
enumerable: true, | ||
get: function () { | ||
return _status.STATUS_ERROR; | ||
} | ||
}); | ||
Object.defineProperty(exports, "STATUS_FATAL", { | ||
enumerable: true, | ||
get: function () { | ||
return _status.STATUS_FATAL; | ||
} | ||
}); | ||
Object.defineProperty(exports, "generateLogs", { | ||
enumerable: true, | ||
get: function () { | ||
return _logHelper.generateLogs; | ||
} | ||
}); | ||
var _EnvironmentRun = require('./EnvironmentRun'); | ||
var _EnvironmentRun = _interopRequireDefault(require("./EnvironmentRun")); | ||
var _EnvironmentRun2 = _interopRequireDefault(_EnvironmentRun); | ||
var _EnvironmentTestcase = _interopRequireDefault(require("./EnvironmentTestcase")); | ||
var _EnvironmentTestcase = require('./EnvironmentTestcase'); | ||
var _StepBase = _interopRequireWildcard(require("./StepBase")); | ||
var _EnvironmentTestcase2 = _interopRequireDefault(_EnvironmentTestcase); | ||
var _StepRegistry = _interopRequireDefault(require("./StepRegistry")); | ||
var _LogAdapter = require('./LogAdapter'); | ||
var _status = require("./status"); | ||
var _LogAdapterMemory = require('./LogAdapterMemory'); | ||
var _StepBase = require('./StepBase'); | ||
var _StepBase2 = _interopRequireDefault(_StepBase); | ||
var _StepRegistry = require('./StepRegistry'); | ||
var _StepRegistry2 = _interopRequireDefault(_StepRegistry); | ||
var _status = require('./status'); | ||
var _logHelper = require('./logHelper'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.EnvironmentRun = _EnvironmentRun2.default; | ||
exports.EnvironmentTestcase = _EnvironmentTestcase2.default; | ||
exports.LogAdapter = _LogAdapter.LogAdapter; | ||
exports.LogAdapterMemory = _LogAdapterMemory.LogAdapterMemory; | ||
exports.getLogAdapter = _LogAdapter.getLogAdapter; | ||
exports.getLogAdapterMemory = _LogAdapterMemory.getLogAdapterMemory; | ||
exports.StepBase = _StepBase2.default; | ||
exports.StepRegistry = _StepRegistry2.default; | ||
exports.STATUS_OK = _status.STATUS_OK; | ||
exports.STATUS_UNKNOWN = _status.STATUS_UNKNOWN; | ||
exports.STATUS_WARNING = _status.STATUS_WARNING; | ||
exports.STATUS_ERROR = _status.STATUS_ERROR; | ||
exports.STATUS_FATAL = _status.STATUS_FATAL; | ||
exports.STEP_TYPE_NORMAL = _StepBase.STEP_TYPE_NORMAL; | ||
exports.STEP_TYPE_SINGLE = _StepBase.STEP_TYPE_SINGLE; | ||
exports.STEP_TYPE_SERVER_ONLY = _StepBase.STEP_TYPE_SERVER_ONLY; | ||
exports.LEVEL_DEBUG = _LogAdapter.LEVEL_DEBUG; | ||
exports.LEVEL_INFO = _LogAdapter.LEVEL_INFO; | ||
exports.LEVEL_WARNING = _LogAdapter.LEVEL_WARNING; | ||
exports.LEVEL_ERROR = _LogAdapter.LEVEL_ERROR; | ||
exports.LEVEL_FATAL = _LogAdapter.LEVEL_FATAL; | ||
exports.DIR_BASE_DATA = _StepBase.DIR_BASE_DATA; | ||
exports.generateLogs = _logHelper.generateLogs; | ||
var _logHelper = require("./logHelper"); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,11 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
exports.generateLogs = generateLogs; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -43,3 +36,5 @@ * This function generates the log message as needed by the logadapter | ||
} else if (typeof messageObj === 'string') { | ||
data = { message: messageObj }; | ||
data = { | ||
message: messageObj | ||
}; | ||
} else { | ||
@@ -52,3 +47,4 @@ data = messageObj; | ||
start: environmentRun.startTime, | ||
id: environmentRun.id | ||
id: environmentRun.id, | ||
name: environmentRun.name | ||
}, | ||
@@ -67,3 +63,5 @@ time: Date.now() | ||
} | ||
const promises = []; | ||
if (environmentTestcase !== undefined) { | ||
@@ -89,3 +87,2 @@ // ---------------------------------------------- | ||
// ---------------------------------------------- | ||
for (const tcEnv of environmentTestcase) { | ||
@@ -113,3 +110,3 @@ meta.tc = { | ||
return _promise2.default.all(promises); | ||
return Promise.all(promises); | ||
} |
@@ -6,6 +6,12 @@ "use strict"; | ||
}); | ||
const STATUS_OK = exports.STATUS_OK = 1; | ||
const STATUS_UNKNOWN = exports.STATUS_UNKNOWN = 2; | ||
const STATUS_WARNING = exports.STATUS_WARNING = 3; | ||
const STATUS_ERROR = exports.STATUS_ERROR = 4; | ||
const STATUS_FATAL = exports.STATUS_FATAL = 5; | ||
exports.STATUS_FATAL = exports.STATUS_ERROR = exports.STATUS_WARNING = exports.STATUS_UNKNOWN = exports.STATUS_OK = void 0; | ||
const STATUS_OK = 1; | ||
exports.STATUS_OK = STATUS_OK; | ||
const STATUS_UNKNOWN = 2; | ||
exports.STATUS_UNKNOWN = STATUS_UNKNOWN; | ||
const STATUS_WARNING = 3; | ||
exports.STATUS_WARNING = STATUS_WARNING; | ||
const STATUS_ERROR = 4; | ||
exports.STATUS_ERROR = STATUS_ERROR; | ||
const STATUS_FATAL = 5; | ||
exports.STATUS_FATAL = STATUS_FATAL; |
@@ -1,36 +0,28 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.DIR_BASE_DATA = exports.STEP_TYPE_SERVER_ONLY = exports.STEP_TYPE_SINGLE = exports.STEP_TYPE_NORMAL = undefined; | ||
exports.default = exports.DIR_BASE_DATA = exports.STEP_TYPE_SERVER_ONLY = exports.STEP_TYPE_SINGLE = exports.STEP_TYPE_NORMAL = void 0; | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
var _assert = _interopRequireDefault(require("assert")); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
var _uuid = _interopRequireDefault(require("uuid")); | ||
var _assert = require('assert'); | ||
var _logadapter = require("@bitdiver/logadapter"); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
var _logHelper = require("./logHelper"); | ||
var _uuid = require('uuid'); | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
var _LogAdapter = require('./LogAdapter'); | ||
var _logHelper = require('./logHelper'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const uuidV4 = _uuid2.default.v4; | ||
const STEP_TYPE_NORMAL = exports.STEP_TYPE_NORMAL = 'normal'; | ||
const STEP_TYPE_SINGLE = exports.STEP_TYPE_SINGLE = 'single'; | ||
const STEP_TYPE_SERVER_ONLY = exports.STEP_TYPE_SERVER_ONLY = 'serverSingle'; | ||
// The variable name for the base data dir. All file pathes for | ||
const uuidV4 = _uuid.default.v4; | ||
const STEP_TYPE_NORMAL = 'normal'; | ||
exports.STEP_TYPE_NORMAL = STEP_TYPE_NORMAL; | ||
const STEP_TYPE_SINGLE = 'single'; | ||
exports.STEP_TYPE_SINGLE = STEP_TYPE_SINGLE; | ||
const STEP_TYPE_SERVER_ONLY = 'serverSingle'; // The variable name for the base data dir. All file pathes for | ||
// step data is relative to this directory | ||
const DIR_BASE_DATA = exports.DIR_BASE_DATA = 'DIR_BASE_DATA'; | ||
exports.STEP_TYPE_SERVER_ONLY = STEP_TYPE_SERVER_ONLY; | ||
const DIR_BASE_DATA = 'DIR_BASE_DATA'; | ||
/** | ||
@@ -41,53 +33,45 @@ * The base class for a step. Later on there will be one instace of this class per step and per testcase. | ||
*/ | ||
exports.DIR_BASE_DATA = DIR_BASE_DATA; | ||
class StepBase { | ||
constructor(opts = {}) { | ||
this.logAdapter = opts.logAdapter ? opts.logAdapter : (0, _LogAdapter.getLogAdapter)(); | ||
this.logAdapter = opts.logAdapter ? opts.logAdapter : (0, _logadapter.getLogAdapterConsole)(); | ||
this.type = opts.type ? opts.type : STEP_TYPE_NORMAL; // creates a unique step instance id | ||
this.type = opts.type ? opts.type : STEP_TYPE_NORMAL; | ||
// creates a unique step instance id | ||
this.stepInstanceId = uuidV4(); | ||
// A step can store information in the testcase environment. So a step could provide data | ||
this.stepInstanceId = uuidV4(); // A step can store information in the testcase environment. So a step could provide data | ||
// to other steps in the same testcase. For a single step or a server only step this is an | ||
// array of testcase environments | ||
this.environmentTestcase = undefined; | ||
this.environmentRun = undefined; // The name of this step | ||
this.environmentRun = undefined; | ||
// The name of this step | ||
this.name = opts.name; | ||
// The idea of the testmode is to test the run of a step without executing it completly. | ||
this.name = opts.name; // The idea of the testmode is to test the run of a step without executing it completly. | ||
// So the suite could be tested. This is important for long running tests | ||
this.testMode = false; | ||
// Normaly a step will only be executed if there is data defined for the testcase. | ||
this.testMode = false; // Normaly a step will only be executed if there is data defined for the testcase. | ||
// but some steps do not need any data. Then this must be set to false. | ||
this.needData = true; | ||
if (opts.needData !== undefined) { | ||
this.needData = opts.needData; | ||
} | ||
// Stores the data for the current testcase. If it is a single step then this is an array | ||
} // Stores the data for the current testcase. If it is a single step then this is an array | ||
// of data. | ||
this.data = undefined; | ||
// This is set by the runner. The number of this stepin the list of all the steps | ||
this.data = undefined; // This is set by the runner. The number of this stepin the list of all the steps | ||
// Start with '1' | ||
this.countCurrent = 0; | ||
// This is set by the runner. How many steps to be excuted in this run | ||
this.countAll = 0; | ||
this.countCurrent = 0; // This is set by the runner. How many steps to be excuted in this run | ||
// If this is set to true, the step will executed even if the testcase is already failed | ||
this.countAll = 0; // If this is set to true, the step will executed even if the testcase is already failed | ||
// This is important for cleanup steps, for Example. | ||
this.runOnError = opts.runOnError !== undefined ? opts.runOnError : false; | ||
// Allows to define how many parallel exection are possible on a per step basis. | ||
this.runOnError = opts.runOnError !== undefined ? opts.runOnError : false; // Allows to define how many parallel exection are possible on a per step basis. | ||
// This value is normaly defined in the runner, but when given here it will overwrite | ||
// the runner if this value is less | ||
this.maxParallelSteps = opts.maxParallelSteps; | ||
} | ||
/** | ||
@@ -97,6 +81,7 @@ * First the start method will be called for all the step instances of the step | ||
*/ | ||
start() { | ||
return _promise2.default.resolve(); | ||
return Promise.resolve(); | ||
} | ||
/** | ||
@@ -106,6 +91,7 @@ * This method will be called just before the run method | ||
*/ | ||
beforeRun() { | ||
return _promise2.default.resolve(); | ||
return Promise.resolve(); | ||
} | ||
/** | ||
@@ -115,6 +101,7 @@ * This method is doing the work | ||
*/ | ||
run() { | ||
return this.doRun(); | ||
} | ||
/** | ||
@@ -124,6 +111,7 @@ * @return promise {promise} A promise to signal that the method is finished | ||
*/ | ||
doRun() { | ||
return _promise2.default.resolve(); | ||
return Promise.resolve(); | ||
} | ||
/** | ||
@@ -134,6 +122,7 @@ * This method will be called just after the run is finished | ||
*/ | ||
afterRun() { | ||
return _promise2.default.resolve(); | ||
return Promise.resolve(); | ||
} | ||
/** | ||
@@ -143,6 +132,7 @@ * This method will be called when all the step instances of this step are finished | ||
*/ | ||
end() { | ||
return _promise2.default.resolve(); | ||
return Promise.resolve(); | ||
} | ||
/** | ||
@@ -156,7 +146,9 @@ * Logs a debug message. | ||
*/ | ||
logDebug(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_DEBUG, environmentTestcase); | ||
_assert.default.ok(options, 'No log message given'); | ||
return this._log(options, _logadapter.LEVEL_DEBUG, environmentTestcase); | ||
} | ||
/** | ||
@@ -169,7 +161,9 @@ * Logs a info message. | ||
*/ | ||
logInfo(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_INFO, environmentTestcase); | ||
_assert.default.ok(options, 'No log message given'); | ||
return this._log(options, _logadapter.LEVEL_INFO, environmentTestcase); | ||
} | ||
/** | ||
@@ -182,7 +176,9 @@ * Logs a warning message. | ||
*/ | ||
logWarning(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_WARNING, environmentTestcase); | ||
_assert.default.ok(options, 'No log message given'); | ||
return this._log(options, _logadapter.LEVEL_WARNING, environmentTestcase); | ||
} | ||
/** | ||
@@ -196,7 +192,9 @@ * Logs a error message. | ||
*/ | ||
logError(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_ERROR, environmentTestcase); | ||
_assert.default.ok(options, 'No log message given'); | ||
return this._log(options, _logadapter.LEVEL_ERROR, environmentTestcase); | ||
} | ||
/** | ||
@@ -210,7 +208,9 @@ * Logs a fatal message. | ||
*/ | ||
logFatal(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_FATAL, environmentTestcase); | ||
_assert.default.ok(options, 'No log message given'); | ||
return this._log(options, _logadapter.LEVEL_FATAL, environmentTestcase); | ||
} | ||
/** | ||
@@ -225,8 +225,12 @@ * Calls the logger with the given messageObj. | ||
*/ | ||
_log(messageObj, logLevel = _LogAdapter.LEVEL_INFO, environmentTestcase = this.environmentTestcase) { | ||
_assert2.default.ok(messageObj, 'No log message given'); | ||
_log(messageObj, logLevel = _logadapter.LEVEL_INFO, environmentTestcase = this.environmentTestcase) { | ||
_assert.default.ok(messageObj, 'No log message given'); | ||
return (0, _logHelper.generateLogs)(this.environmentRun, environmentTestcase, this.logAdapter, messageObj, logLevel, this); | ||
} | ||
} | ||
exports.default = StepBase; |
@@ -1,17 +0,12 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _assert = _interopRequireDefault(require("assert")); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _assert = require('assert'); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -22,5 +17,4 @@ * This registry stores all the available steps by there name. | ||
constructor() { | ||
this.stepMap = new _map2.default(); | ||
this.stepMap = new Map(); | ||
} | ||
/** | ||
@@ -31,6 +25,9 @@ * Register a class for a step by a given name | ||
*/ | ||
registerStep(stepName, step) { | ||
_assert2.default.ok(stepName, 'A step name must be provided'); | ||
_assert2.default.ok(step, 'A step class must be provided'); | ||
_assert.default.ok(stepName, 'A step name must be provided'); | ||
_assert.default.ok(step, 'A step class must be provided'); | ||
if (this.stepMap.has(stepName)) { | ||
@@ -44,3 +41,2 @@ // A step with the same name was already registred | ||
} | ||
/** | ||
@@ -51,4 +47,6 @@ * Returns an instance of a step class | ||
*/ | ||
getStep(stepName) { | ||
_assert2.default.ok(stepName, 'A step name must be provided'); | ||
_assert.default.ok(stepName, 'A step name must be provided'); | ||
@@ -58,7 +56,11 @@ if (!this.stepMap.has(stepName)) { | ||
} | ||
const stepClass = this.stepMap.get(stepName); | ||
return new stepClass({ | ||
name: stepName | ||
}); | ||
} | ||
return new stepClass({ name: stepName }); | ||
} | ||
} | ||
exports.default = StepRegistry; |
122
package.json
{ | ||
"name": "@bitdiver/model", | ||
"version": "1.3.6", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bitdiver/model.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/bitdiver/model/issues" | ||
}, | ||
"homepage": "https://github.com/bitdiver/model#readme", | ||
"scripts": { | ||
"build": "npm run src_format && npm run src_lint && babel src -d lib", | ||
"src_lint": "eslint src tests", | ||
"src_format": "prettier --no-semi --single-quote --trailing-comma es5 --write \"{src,tests}/**/*.js\"", | ||
"test_only": "jest", | ||
"test": "npm run build && jest -c jest.config.json", | ||
"debug": "npm run build && node --inspect-brk ./node_modules/.bin/jest -i --config=./jest.config.json", | ||
"prepare": "npm run build" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Torsten Link", | ||
"email": "torstenlink@gmx.de" | ||
}, | ||
{ | ||
"name": "Markus Felten", | ||
"email": "markus.felten@gmx.de" | ||
} | ||
], | ||
"license": "ISC", | ||
"devDependencies": { | ||
"assert": "1.4.1", | ||
"babel-cli": "6.26.0", | ||
"babel-core": "6.26.3", | ||
"babel-eslint": "8.2.6", | ||
"babel-jest": "23.4.2", | ||
"babel-plugin-transform-object-rest-spread": "6.26.0", | ||
"babel-plugin-transform-runtime": "6.23.0", | ||
"babel-polyfill": "6.26.0", | ||
"babel-preset-env": "1.7.0", | ||
"babel-preset-flow": "6.23.0", | ||
"babel-register": "6.26.0", | ||
"cz-conventional-changelog": "2.1.0", | ||
"eslint": "5.2.0", | ||
"eslint-config-prettier": "2.9.0", | ||
"eslint-plugin-babel": "5.1.0", | ||
"jest": "23.4.2", | ||
"jest-cli": "23.4.2", | ||
"jest-environment-node-debug": "2.0.0", | ||
"prettier": "1.14.0", | ||
"regenerator-runtime": "0.12.0", | ||
"semantic-release": "15.9.3" | ||
}, | ||
"dependencies": { | ||
"jsonfile": "4.0.0", | ||
"uuid": "3.3.2" | ||
} | ||
"name": "@bitdiver/model", | ||
"version": "1.3.7", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bitdiver/model.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/bitdiver/model/issues" | ||
}, | ||
"homepage": "https://github.com/bitdiver/model#readme", | ||
"scripts": { | ||
"build": "npm run src_format && npm run src_lint && babel src -d lib", | ||
"src_lint": "eslint src tests", | ||
"src_format": "prettier --no-semi --single-quote --trailing-comma es5 --write \"{src,tests}/**/*.js\"", | ||
"test_only": "jest", | ||
"test": "npm run build && jest -c jest.config.json", | ||
"debug": "npm run build && node --inspect-brk ./node_modules/.bin/jest -i --config=./jest.config.json", | ||
"prepare": "npm run build" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Torsten Link", | ||
"email": "torstenlink@gmx.de" | ||
}, | ||
{ | ||
"name": "Markus Felten", | ||
"email": "markus.felten@gmx.de" | ||
} | ||
], | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@babel/cli": "7.2.3", | ||
"@babel/core": "7.2.2", | ||
"@babel/node": "7.2.2", | ||
"@babel/plugin-proposal-object-rest-spread": "7.3.1", | ||
"@babel/plugin-transform-runtime": "7.2.0", | ||
"@babel/polyfill": "7.2.5", | ||
"@babel/preset-env": "7.3.1", | ||
"@babel/register": "7.0.0", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-eslint": "10.0.1", | ||
"babel-jest": "24.0.0", | ||
"cz-conventional-changelog": "2.1.0", | ||
"eslint": "5.12.1", | ||
"eslint-config-prettier": "4.0.0", | ||
"eslint-plugin-babel": "5.3.0", | ||
"jest": "24.0.0", | ||
"jest-cli": "24.0.0", | ||
"jest-environment-node-debug": "2.0.0", | ||
"prettier": "1.16.2", | ||
"regenerator-runtime": "0.13.1", | ||
"semantic-release": "15.13.3" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "7.3.1", | ||
"@bitdiver/logadapter": "1.0.6", | ||
"uuid": "3.3.2" | ||
} | ||
} |
@@ -1,8 +0,5 @@ | ||
import { | ||
StepBase, | ||
getLogAdapterMemory, | ||
EnvironmentRun, | ||
EnvironmentTestcase, | ||
} from '../lib/index' | ||
import { StepBase, EnvironmentRun, EnvironmentTestcase } from '../lib/index' | ||
import { getLogAdapterMemory } from '@bitdiver/logadapter' | ||
const LOG_ADAPTER_LOG_LEVEL = 'error' | ||
@@ -85,3 +82,3 @@ | ||
function getStep() { | ||
logAdapterMemory.clear() | ||
logAdapterMemory.reset() | ||
const step = new StepBase({ logAdapter: logAdapterMemory }) | ||
@@ -88,0 +85,0 @@ const envRun = new EnvironmentRun() |
@@ -1,13 +0,6 @@ | ||
import { | ||
StepBase, | ||
getLogAdapterMemory, | ||
EnvironmentRun, | ||
EnvironmentTestcase, | ||
} from '../lib/index' | ||
import { StepBase, EnvironmentRun, EnvironmentTestcase } from '../lib/index' | ||
const LOG_ADAPTER_LOG_LEVEL = 'debug' | ||
import { getLogAdapterMemory } from '@bitdiver/logadapter' | ||
const logAdapterMemory = getLogAdapterMemory({ | ||
logLevel: LOG_ADAPTER_LOG_LEVEL, | ||
}) | ||
const logAdapterMemory = getLogAdapterMemory({ logLevel: 'debug' }) | ||
@@ -131,3 +124,3 @@ test('Logging: info', () => { | ||
function getStep() { | ||
logAdapterMemory.clear() | ||
logAdapterMemory.reset() | ||
const step = new StepBase({ logAdapter: logAdapterMemory }) | ||
@@ -134,0 +127,0 @@ const envRun = new EnvironmentRun() |
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
41675
3
25
771
+ Added@babel/runtime@7.3.1
+ Added@bitdiver/logadapter@1.0.6
+ Added@babel/runtime@7.3.1(transitive)
+ Added@bitdiver/logadapter@1.0.6(transitive)
+ Addedminimist@0.0.8(transitive)
+ Addedmkdirp@0.5.1(transitive)
+ Addedmoment@2.24.0(transitive)
+ Addedregenerator-runtime@0.12.1(transitive)
- Removedjsonfile@4.0.0
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@4.0.0(transitive)