@bitdiver/model
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -12,5 +12,5 @@ 'use strict'; | ||
var _LogAdapter = require('./LogAdapter'); | ||
var _assert = require('assert'); | ||
var _logHelper = require('./logHelper'); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
@@ -21,2 +21,6 @@ var _uuid = require('uuid'); | ||
var _LogAdapter = require('./LogAdapter'); | ||
var _logHelper = require('./logHelper'); | ||
var _status = require('./status'); | ||
@@ -71,70 +75,5 @@ | ||
this.data = undefined; | ||
// This is set by the runner. The number of this step in 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.countCurrent = 0; | ||
} | ||
/** | ||
* Logs a debug message. | ||
* @param options {string/object} The message to log or the properties | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logDebug(options) { | ||
return this._log(options, _LogAdapter.LEVEL_DEBUG); | ||
} | ||
/** | ||
* Logs a info message. | ||
* @param options {string/object} The message to log or the properties | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logInfo(options) { | ||
return this._log(options, _LogAdapter.LEVEL_INFO); | ||
} | ||
/** | ||
* Logs a warning message. | ||
* @param options {string/object} The message to log or the properties | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logWarning(options) { | ||
return this._log(options, _LogAdapter.LEVEL_WARNING); | ||
} | ||
/** | ||
* Logs a error message. | ||
* Error normaly means that the testcase gots an error | ||
* @param options {string/object} The message to log or the properties | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logError(options) { | ||
return this._log(options, _LogAdapter.LEVEL_ERROR); | ||
} | ||
/** | ||
* Logs a fatal message. | ||
* Fatal normaly means that the complete test run needs to be stopped | ||
* @param options {string/object} The message to log or the properties | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logFatal(options) { | ||
return this._log(options, _LogAdapter.LEVEL_FATAL); | ||
} | ||
/** | ||
* Calls the logger with the given messageObj. | ||
* If this is a single step the log will be written for each testcase environment | ||
* @param messageObj {object|string} Either a message or a json object to be logged | ||
* @param logLevel {string} The loglevel to be used | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
_log(messageObj, logLevel = _LogAdapter.LEVEL_INFO) { | ||
return (0, _logHelper.generateLogs)(this.environmentRun, this.environmentTestcase, this.logAdapter, messageObj, logLevel, this); | ||
} | ||
/** | ||
* First the start method will be called for all the step instances of the step | ||
@@ -195,3 +134,81 @@ * @return promise {promise} A promise to signal that the method is finished | ||
} | ||
/** | ||
* Logs a debug message. | ||
* @param options {string/object} The message to log or the properties | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* testcases | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logDebug(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_DEBUG, environmentTestcase); | ||
} | ||
/** | ||
* Logs a info message. | ||
* @param options {string/object} The message to log or the properties | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logInfo(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_INFO, environmentTestcase); | ||
} | ||
/** | ||
* Logs a warning message. | ||
* @param options {string/object} The message to log or the properties | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logWarning(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_WARNING, environmentTestcase); | ||
} | ||
/** | ||
* Logs a error message. | ||
* Error normaly means that the testcase gots an error | ||
* @param options {string/object} The message to log or the properties | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logError(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_ERROR, environmentTestcase); | ||
} | ||
/** | ||
* Logs a fatal message. | ||
* Fatal normaly means that the complete test run needs to be stopped | ||
* @param options {string/object} The message to log or the properties | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
logFatal(options, environmentTestcase) { | ||
_assert2.default.ok(options, 'No log message given'); | ||
return this._log(options, _LogAdapter.LEVEL_FATAL, environmentTestcase); | ||
} | ||
/** | ||
* Calls the logger with the given messageObj. | ||
* If this is a single step the log will be written for each testcase environment | ||
* @param messageObj {object|string} Either a message or a json object to be logged | ||
* @param logLevel {string} The loglevel to be used | ||
* @param environmentTestcase {object} The testcase environment. If given the log | ||
* will only be written for this testcase. If not the log will be written for all the | ||
* @return promise {promise} Indicating that the message was written | ||
*/ | ||
_log(messageObj, logLevel = _LogAdapter.LEVEL_INFO, environmentTestcase = this.environmentTestcase) { | ||
_assert2.default.ok(messageObj, 'No log message given'); | ||
return (0, _logHelper.generateLogs)(this.environmentRun, environmentTestcase, this.logAdapter, messageObj, logLevel, this); | ||
} | ||
} | ||
exports.default = StepBase; |
{ | ||
"name": "@bitdiver/model", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
"debug": "npm run build && node --inspect-brk ./node_modules/.bin/jest -i --config=./jest.config.json", | ||
"prepublish": "npm run build" | ||
"prepare": "npm run build" | ||
}, | ||
@@ -59,4 +59,5 @@ "contributors": [ | ||
"dependencies": { | ||
"jsonfile": "^4.0.0", | ||
"uuid": "^3.1.0" | ||
} | ||
} |
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
46570
878
2
+ Addedjsonfile@^4.0.0
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@4.0.0(transitive)