Socket
Socket
Sign inDemoInstall

html-reporter

Package Overview
Dependencies
Maintainers
7
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-reporter - npm Package Compare versions

Comparing version 2.0.4 to 2.1.0

lib/reporter-helpers.js

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Change Log

<a name="2.1.0"></a>
# [2.1.0](https://github.com/gemini-testing/html-reporter/compare/v2.0.3...v2.1.0) (2018-02-16)
### Bug Fixes
* parse cli ([1949147](https://github.com/gemini-testing/html-reporter/commit/1949147))
### Features
* save diff from hermione assert view ([#42](https://github.com/gemini-testing/html-reporter/issues/42)) ([f4e1c92](https://github.com/gemini-testing/html-reporter/commit/f4e1c92))
<a name="2.0.4"></a>

@@ -7,0 +22,0 @@ ## [2.0.4](https://github.com/gemini-testing/html-reporter/compare/v2.0.3...v2.0.4) (2018-02-06)

31

gemini.js

@@ -7,2 +7,3 @@ 'use strict';

const utils = require('./utils');
const {saveTestImages} = require('./lib/reporter-helpers');
const ReportBuilderFactory = require('./lib/report-builder-factory');

@@ -58,26 +59,2 @@ const parseConfig = require('./lib/config');

function handleTestResultEvent(testResult) {
const actions = [
utils.copyImageAsync(
testResult.referencePath,
utils.getReferenceAbsolutePath(testResult, pluginConfig.path)
)
];
if (!testResult.equal) {
actions.push(
utils.copyImageAsync(
testResult.currentPath,
utils.getCurrentAbsolutePath(testResult, pluginConfig.path)
),
utils.saveDiff(
testResult,
utils.getDiffAbsolutePath(testResult, pluginConfig.path)
)
);
}
return Promise.all(actions);
}
return new Promise((resolve, reject) => {

@@ -95,3 +72,3 @@ let queue = Promise.resolve();

return wrapped.isEqual()
? handleTestResultEvent(wrapped)
? saveTestImages(wrapped, pluginConfig)
: handleErrorEvent(wrapped);

@@ -102,3 +79,3 @@ });

gemini.on(gemini.events.TEST_RESULT, (testResult) => {
queue = queue.then(() => handleTestResultEvent(reportBuilder.format(testResult)));
queue = queue.then(() => saveTestImages(reportBuilder.format(testResult), pluginConfig));
});

@@ -112,3 +89,3 @@

queue = queue.then(() => handleTestResultEvent(reportBuilder.format(testResult)));
queue = queue.then(() => saveTestImages(reportBuilder.format(testResult), pluginConfig));
});

@@ -115,0 +92,0 @@

@@ -7,2 +7,3 @@ 'use strict';

const utils = require('./utils');
const {saveTestImages} = require('./lib/reporter-helpers');
const ReportBuilderFactory = require('./lib/report-builder-factory');

@@ -51,12 +52,18 @@ const parseConfig = require('./lib/config');

hermione.on(hermione.events.TEST_PENDING, (result) => reportBuilder.addSkipped(result));
hermione.on(hermione.events.TEST_PENDING, (testResult) => reportBuilder.addSkipped(testResult));
hermione.on(hermione.events.TEST_PASS, (result) => reportBuilder.addSuccess(result));
hermione.on(hermione.events.TEST_PASS, (testResult) => reportBuilder.addSuccess(testResult));
hermione.on(hermione.events.TEST_FAIL, (result) => reportBuilder.addError(result));
hermione.on(hermione.events.TEST_FAIL, failHandler);
hermione.on(hermione.events.RETRY, (result) => reportBuilder.addRetry(result));
hermione.on(hermione.events.RETRY, failHandler);
hermione.on(hermione.events.RUNNER_END, (stats) => resolve(reportBuilder.setStats(stats)));
});
function failHandler(testResult) {
const wrapped = reportBuilder.format(testResult);
return wrapped.hasDiff ? reportBuilder.addFail(testResult) : reportBuilder.addError(testResult);
}
}

@@ -73,2 +80,8 @@

function failHandler(testResult) {
const wrapped = reportBuilder.format(testResult);
return wrapped.hasDiff ? saveTestImages(wrapped, pluginConfig) : handleErrorEvent(wrapped);
}
return new Promise((resolve, reject) => {

@@ -78,7 +91,7 @@ let queue = Promise.resolve();

hermione.on(hermione.events.RETRY, (testResult) => {
queue = queue.then(() => handleErrorEvent(reportBuilder.format(testResult)));
queue = queue.then(() => failHandler(testResult));
});
hermione.on(hermione.events.TEST_FAIL, (testResult) => {
queue = queue.then(() => handleErrorEvent(reportBuilder.format(testResult)));
queue = queue.then(() => failHandler(testResult));
});

@@ -85,0 +98,0 @@

@@ -7,2 +7,4 @@ 'use strict';

const IMAGE_DIFF_ERROR = 'ImageDiffError';
module.exports = class HermioneTestResultAdapter extends TestAdapter {

@@ -16,2 +18,10 @@ constructor(testResult, config = {}) {

saveDiffTo(...args) {
return this._testResult.err.saveDiffTo(...args);
}
get hasDiff() {
return this._testResult.err.type === IMAGE_DIFF_ERROR;
}
get error() {

@@ -18,0 +28,0 @@ return JSON.stringify(_.pick(this._testResult.err, 'message', 'stack', 'stateName'), null, 2);

{
"name": "html-reporter",
"version": "2.0.4",
"version": "2.1.0",
"description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report",

@@ -5,0 +5,0 @@ "scripts": {

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