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 1.3.3 to 2.0.0

gemini.js

20

CHANGELOG.md

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

<a name="2.0.0"></a>
# [2.0.0](https://github.com/gemini-testing/html-reporter/compare/v1.1.0...v2.0.0) (2018-01-28)
### Bug Fixes
* change metaInfo in data.js from html-string to object ([2ea8301](https://github.com/gemini-testing/html-reporter/commit/2ea8301))
* Meta-info view ([df3f031](https://github.com/gemini-testing/html-reporter/commit/df3f031))
* retry images do not change ([885bf8a](https://github.com/gemini-testing/html-reporter/commit/885bf8a))
### Features
* adapt screenshots width to window width ([dc0ac44](https://github.com/gemini-testing/html-reporter/commit/dc0ac44))
* add hermione html reporter ([ee21f76](https://github.com/gemini-testing/html-reporter/commit/ee21f76))
* replace handlebars with react+redux implementation ([1e0ceee](https://github.com/gemini-testing/html-reporter/commit/1e0ceee))
* suites colored in grey if all children are skipped ([b8f784b](https://github.com/gemini-testing/html-reporter/commit/b8f784b))
<a name="1.3.3"></a>

@@ -7,0 +27,0 @@ ## [1.3.3](https://github.com/gemini-testing/html-reporter/compare/v1.3.2...v1.3.3) (2018-01-23)

31

lib/config.js

@@ -13,2 +13,10 @@ 'use strict';

const isString = (name) => {
return (v) => {
if (!_.isString(v)) {
throw new Error(`"${name}" option must be string, but got ${typeof v}`);
}
};
};
const getParser = () => {

@@ -19,15 +27,28 @@ return root(section({

parseEnv: JSON.parse,
validate: _.isBoolean
validate: (v) => {
if (!_.isBoolean(v)) {
throw new Error(`"enabled" option must be boolean, but got ${typeof v}`);
}
}
}),
screenshotOnReject: option({
defaultValue: true,
parseEnv: JSON.parse,
validate: (v) => {
if (!_.isBoolean(v) && !_.isPlainObject(v)) {
throw new Error(`"screenshotOnReject" option must be boolean or plain object, but got ${typeof v}`);
}
}
}),
path: option({
defaultValue: 'gemini-report',
validate: _.isString
defaultValue: 'html-report',
validate: isString('path')
}),
defaultView: option({
defaultValue: 'all',
validate: _.isString
validate: isString('defaultView')
}),
baseHost: option({
defaultValue: '',
validate: _.isString
validate: isString('baseHost')
})

@@ -34,0 +55,0 @@ }), {envPrefix: ENV_PREFIX, cliPrefix: CLI_PREFIX});

5

lib/static/components/state/screenshot.js

@@ -20,3 +20,6 @@ 'use strict';

<LazyLoad offsetVertical={800}>
<img src={url}/>
<img
src={url}
className="image-box__screenshot"
/>
</LazyLoad>

@@ -23,0 +26,0 @@ );

{
"name": "html-reporter",
"version": "1.3.3",
"description": "Plugin for gemini which is intended to aggregate the results of tests running into html report",
"main": "index.js",
"version": "2.0.0",
"description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report",
"scripts": {

@@ -28,2 +27,3 @@ "lint": "eslint .",

"gemini",
"hermione",
"plugin",

@@ -30,0 +30,0 @@ "html-reporter"

# html-reporter
Plugin for [gemini](https://github.com/gemini-testing/gemini) which is intended to
aggregate the results of tests running into html report.
Plugin for [gemini](https://github.com/gemini-testing/gemini) and [hermione](https://github.com/gemini-testing/hermione) which is intended to aggregate the results of tests running into html report.
You can read more about gemini plugins [here](https://github.com/gemini-testing/gemini/blob/master/doc/plugins.md).
You can read more about gemini plugins [here](https://github.com/gemini-testing/gemini/blob/master/doc/plugins.md) and about hermione plugins [here](https://github.com/gemini-testing/hermione#plugins).

@@ -26,2 +25,5 @@ ## Installation

* **baseHost** (optional) - `String` - it changes original host for view in the browser; by default original host does not change
* **screenshotOnReject** (optional, only for hermione) - attaches a screenshot of a
current page on test fail. Can be boolean or object with httpTimeout option. If
`screenshotOnReject` is set as `true`, then will be used common `httpTimeout` value. `true` by default. See example of usage [here](#hermione-usage).

@@ -38,3 +40,3 @@ Also there is ability to override plugin parameters by CLI options or environment variables

### Usage
### Gemini Usage

@@ -48,3 +50,3 @@ Add plugin to your `gemini` config file:

plugins: {
'html-reporter': {
'html-reporter/gemini': {
enabled: true,

@@ -61,2 +63,26 @@ path: 'my/gemini-reports',

### Hermione Usage
Add plugin to your `hermione` config file:
```js
module.exports = {
// ...
system: {
plugins: {
'html-reporter/hermione': {
enabled: true,
path: 'my/hermione-reports',
defaultView: 'all',
baseHost: 'test.com',
screenshotOnReject: {
httpTimeout: 10000
}
}
}
},
//...
}
```
## Testing

@@ -63,0 +89,0 @@

'use strict';
const chalk = require('chalk');
const _ = require('lodash');
const path = require('path');
const Promise = require('bluebird');
const fs = Promise.promisifyAll(require('fs-extra'));

@@ -37,6 +40,6 @@ const getReferencePath = (testResult) => createPath('ref', testResult);

'images',
result.suite.path,
result.state.name,
result.imageDir,
`${result.browserId}~${kind}${retrySuffix}.png`
);
const pathToImage = path.join.apply(null, components);

@@ -47,2 +50,41 @@

function copyImage(srcPath, destPath) {
return makeDirFor(destPath)
.then(() => fs.copySync(srcPath, destPath));
}
function copyImageAsync(srcPath, destPath) {
return makeDirFor(destPath)
.then(() => fs.copy(srcPath, destPath));
}
/**
* @param {TestStateResult} result
* @param {String} destPath
* @returns {Promise}
*/
function saveDiff(result, destPath) {
return makeDirFor(destPath)
.then(() => result.saveDiffTo(destPath));
}
/**
* @param {String} destPath
*/
function makeDirFor(destPath) {
return fs.mkdirsAsync(path.dirname(destPath));
}
const logger = _.pick(console, ['log', 'warn', 'error']);
function logPathToHtmlReport(reportBuilder) {
const reportPath = `file://${reportBuilder.reportPath}`;
logger.log(`Your HTML report is here: ${chalk.yellow(reportPath)}`);
}
function logError(e) {
logger.error(e.stack);
}
module.exports = {

@@ -57,3 +99,10 @@ getReferencePath,

logger: _.pick(console, ['log', 'warn', 'error'])
copyImage,
copyImageAsync,
saveDiff,
makeDirFor,
logger,
logPathToHtmlReport,
logError
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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