testcafe-reporter-spec
Advanced tools
Comparing version 2.1.1 to 2.2.0
235
lib/index.js
@@ -1,115 +0,126 @@ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports['default'] = function () { | ||
return { | ||
noColors: false, | ||
startTime: null, | ||
afterErrorList: false, | ||
testCount: 0, | ||
skipped: 0, | ||
reportTaskStart: function reportTaskStart(startTime, userAgents, testCount) { | ||
var _this = this; | ||
this.startTime = startTime; | ||
this.testCount = testCount; | ||
this.setIndent(1).useWordWrap(true).write(this.chalk.bold('Running tests in:')).newline(); | ||
userAgents.forEach(function (ua) { | ||
_this.write('- ' + _this.chalk.blue(ua)).newline(); | ||
}); | ||
}, | ||
reportFixtureStart: function reportFixtureStart(name) { | ||
this.setIndent(1).useWordWrap(true); | ||
if (this.afterErrorList) this.afterErrorList = false;else this.newline(); | ||
this.write(name).newline(); | ||
}, | ||
_renderErrors: function _renderErrors(errs) { | ||
var _this2 = this; | ||
this.setIndent(3).newline(); | ||
errs.forEach(function (err, idx) { | ||
var prefix = _this2.chalk.red(idx + 1 + ') '); | ||
_this2.newline().write(_this2.formatError(err, prefix)).newline().newline(); | ||
}); | ||
}, | ||
reportTestDone: function reportTestDone(name, testRunInfo) { | ||
var hasErr = !!testRunInfo.errs.length; | ||
var symbol = null; | ||
var nameStyle = null; | ||
if (testRunInfo.skipped) { | ||
this.skipped++; | ||
symbol = this.chalk.cyan('-'); | ||
nameStyle = this.chalk.cyan; | ||
} else if (hasErr) { | ||
symbol = this.chalk.red.bold(this.symbols.err); | ||
nameStyle = this.chalk.red.bold; | ||
} else { | ||
symbol = this.chalk.green(this.symbols.ok); | ||
nameStyle = this.chalk.grey; | ||
} | ||
var title = symbol + ' ' + nameStyle(name); | ||
this.setIndent(1).useWordWrap(true); | ||
if (testRunInfo.unstable) title += this.chalk.yellow(' (unstable)'); | ||
if (testRunInfo.screenshotPath) title += ' (screenshots: ' + this.chalk.underline.grey(testRunInfo.screenshotPath) + ')'; | ||
this.write(title); | ||
if (hasErr) this._renderErrors(testRunInfo.errs); | ||
this.afterErrorList = hasErr; | ||
this.newline(); | ||
}, | ||
_renderWarnings: function _renderWarnings(warnings) { | ||
var _this3 = this; | ||
this.newline().setIndent(1).write(this.chalk.bold.yellow('Warnings (' + warnings.length + '):')).newline(); | ||
warnings.forEach(function (msg) { | ||
_this3.setIndent(1).write(_this3.chalk.bold.yellow('--')).newline().setIndent(2).write(msg).newline(); | ||
}); | ||
}, | ||
reportTaskDone: function reportTaskDone(endTime, passed, warnings) { | ||
var durationMs = endTime - this.startTime; | ||
var durationStr = this.moment.duration(durationMs).format('h[h] mm[m] ss[s]'); | ||
var footer = passed === this.testCount ? this.chalk.bold.green(this.testCount + ' passed') : this.chalk.bold.red(this.testCount - passed + '/' + this.testCount + ' failed'); | ||
footer += this.chalk.grey(' (' + durationStr + ')'); | ||
if (!this.afterErrorList) this.newline(); | ||
this.setIndent(1).useWordWrap(true); | ||
this.newline().write(footer).newline(); | ||
if (this.skipped > 0) { | ||
this.write(this.chalk.cyan(this.skipped + ' skipped')).newline(); | ||
} | ||
if (warnings.length) this._renderWarnings(warnings); | ||
exports["default"] = _default; | ||
function _default() { | ||
return { | ||
noColors: false, | ||
startTime: null, | ||
afterErrorList: false, | ||
testCount: 0, | ||
skipped: 0, | ||
reportTaskStart: function reportTaskStart(startTime, userAgents, testCount) { | ||
var _this = this; | ||
this.startTime = startTime; | ||
this.testCount = testCount; | ||
var writeData = { | ||
startTime: startTime, | ||
userAgents: userAgents, | ||
testCount: testCount | ||
}; | ||
this.setIndent(1).useWordWrap(true).write(this.chalk.bold('Running tests in:'), writeData).newline(); | ||
userAgents.forEach(function (ua) { | ||
_this.write("- ".concat(_this.chalk.blue(ua)), writeData).newline(); | ||
}); | ||
}, | ||
reportFixtureStart: function reportFixtureStart(name, path, meta) { | ||
this.setIndent(1).useWordWrap(true); | ||
if (this.afterErrorList) this.afterErrorList = false;else this.newline(); | ||
var writeData = { | ||
name: name, | ||
path: path, | ||
meta: meta | ||
}; | ||
this.write(name, writeData).newline(); | ||
}, | ||
_renderErrors: function _renderErrors(errs, writeData) { | ||
var _this2 = this; | ||
this.setIndent(3).newline(); | ||
errs.forEach(function (err, idx) { | ||
var prefix = _this2.chalk.red("".concat(idx + 1, ") ")); | ||
_this2.newline().write(_this2.formatError(err, prefix), writeData).newline().newline(); | ||
}); | ||
}, | ||
reportTestDone: function reportTestDone(name, testRunInfo, meta) { | ||
var hasErr = !!testRunInfo.errs.length; | ||
var symbol = null; | ||
var nameStyle = null; | ||
if (testRunInfo.skipped) { | ||
this.skipped++; | ||
symbol = this.chalk.cyan('-'); | ||
nameStyle = this.chalk.cyan; | ||
} else if (hasErr) { | ||
symbol = this.chalk.red.bold(this.symbols.err); | ||
nameStyle = this.chalk.red.bold; | ||
} else { | ||
symbol = this.chalk.green(this.symbols.ok); | ||
nameStyle = this.chalk.grey; | ||
} | ||
var title = "".concat(symbol, " ").concat(nameStyle(name)); | ||
this.setIndent(1).useWordWrap(true); | ||
if (testRunInfo.unstable) title += this.chalk.yellow(' (unstable)'); | ||
if (testRunInfo.screenshotPath) title += " (screenshots: ".concat(this.chalk.underline.grey(testRunInfo.screenshotPath), ")"); | ||
var writeData = { | ||
name: name, | ||
testRunInfo: testRunInfo, | ||
meta: meta | ||
}; | ||
this.write(title, writeData); | ||
this._renderReportData(testRunInfo.reportData, testRunInfo.browsers, writeData); | ||
if (hasErr) this._renderErrors(testRunInfo.errs, writeData); | ||
this.afterErrorList = hasErr; | ||
this.newline(); | ||
}, | ||
_renderReportData: function _renderReportData(reportData, browsers, writeData) { | ||
var _this3 = this; | ||
if (!reportData) return; | ||
if (!Object.values(reportData).some(function (data) { | ||
return data.length; | ||
})) return; | ||
var renderBrowserName = browsers.length > 1; | ||
var dataIndent = browsers.length > 1 ? 3 : 2; | ||
this.newline().setIndent(1).write('Report data:'); | ||
browsers.forEach(function (_ref) { | ||
var testRunId = _ref.testRunId, | ||
prettyUserAgent = _ref.prettyUserAgent; | ||
var browserReportData = reportData[testRunId]; | ||
if (!browserReportData) return; | ||
if (renderBrowserName) { | ||
_this3.setIndent(2).newline().write(prettyUserAgent, writeData); | ||
} | ||
}; | ||
}; | ||
module.exports = exports['default']; | ||
browserReportData.forEach(function (data) { | ||
_this3.setIndent(dataIndent).newline().write("- ".concat(data), writeData); | ||
}); | ||
}); | ||
}, | ||
_renderWarnings: function _renderWarnings(warnings, writeData) { | ||
var _this4 = this; | ||
this.newline().setIndent(1).write(this.chalk.bold.yellow("Warnings (".concat(warnings.length, "):")), writeData).newline(); | ||
warnings.forEach(function (msg) { | ||
_this4.setIndent(1).write(_this4.chalk.bold.yellow('--'), writeData).newline().setIndent(2).write(msg, writeData).newline(); | ||
}); | ||
}, | ||
reportTaskDone: function reportTaskDone(endTime, passed, warnings, result) { | ||
var durationMs = endTime - this.startTime; | ||
var durationStr = this.moment.duration(durationMs).format('h[h] mm[m] ss[s]'); | ||
var footer = passed === this.testCount ? this.chalk.bold.green("".concat(this.testCount, " passed")) : this.chalk.bold.red("".concat(this.testCount - passed, "/").concat(this.testCount, " failed")); | ||
footer += this.chalk.grey(" (".concat(durationStr, ")")); | ||
if (!this.afterErrorList) this.newline(); | ||
this.setIndent(1).useWordWrap(true); | ||
var writeData = { | ||
endTime: endTime, | ||
passed: passed, | ||
warnings: warnings, | ||
result: result | ||
}; | ||
this.newline().write(footer, writeData).newline(); | ||
if (this.skipped > 0) { | ||
this.write(this.chalk.cyan("".concat(this.skipped, " skipped")), writeData).newline(); | ||
} | ||
if (warnings.length) this._renderWarnings(warnings, writeData); | ||
} | ||
}; | ||
} | ||
module.exports = exports.default; |
{ | ||
"name": "testcafe-reporter-spec", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Spec TestCafe reporter plugin.", | ||
@@ -16,2 +16,3 @@ "repository": "https://github.com/DevExpress/testcafe-reporter-spec", | ||
"test": "gulp test", | ||
"build": "gulp build", | ||
"publish-please": "publish-please", | ||
@@ -28,15 +29,18 @@ "prepublish": "publish-please guard" | ||
"devDependencies": { | ||
"babel-eslint": "^4.0.10", | ||
"@babel/core": "^7.21.3", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/eslint-parser": "^7.21.3", | ||
"babel-plugin-add-module-exports": "^1.0.4", | ||
"callsite-record": "^3.2.0", | ||
"del": "^1.2.0", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^5.2.1", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-mocha": "^2.2.0", | ||
"normalize-newline": "^1.0.2", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-eslint": "^6.0.0", | ||
"gulp-mocha": "^8.0.0", | ||
"normalize-newline": "^3.0.0", | ||
"os-family": "^1.0.0", | ||
"publish-please": "^2.1.4", | ||
"publish-please": "^5.5.2", | ||
"read-file-relative": "^1.2.0", | ||
"testcafe": "0.9.0" | ||
"testcafe": "2.4.0" | ||
} | ||
} |
@@ -12,2 +12,6 @@ # testcafe-reporter-spec | ||
This reporter is shipped with TestCafe by default. In most cases, you won't need to install it separately. | ||
However, if you need to install this reporter, you can use the following command. | ||
``` | ||
@@ -14,0 +18,0 @@ npm install testcafe-reporter-spec |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8285
124
42
15
1