diff --git a/CHANGELOG.md b/CHANGELOG.md index 94ca1e4b5..3e6a2de71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [2.20.2](https://github.com/gemini-testing/html-reporter/compare/v2.20.1...v2.20.2) (2018-07-10) + + +### Bug Fixes + +* **hermione gui:** do not show disabled and silently skipped tests ([cf45d11](https://github.com/gemini-testing/html-reporter/commit/cf45d11)) + + + ## [2.20.1](https://github.com/gemini-testing/html-reporter/compare/v2.20.0...v2.20.1) (2018-07-04) diff --git a/lib/gui/tool-runner-factory/hermione/index.js b/lib/gui/tool-runner-factory/hermione/index.js index 9fac13844..2c5d2f88b 100644 --- a/lib/gui/tool-runner-factory/hermione/index.js +++ b/lib/gui/tool-runner-factory/hermione/index.js @@ -24,6 +24,10 @@ module.exports = class HermioneRunner extends BaseToolRunner { _handleRunnableCollection() { this._collection.eachTest((test, browserId) => { + if (test.disabled || test.silentSkip) { + return; + } + const testId = formatId(test.id(), browserId); this._tests[testId] = _.extend(test, {browserId}); diff --git a/package-lock.json b/package-lock.json index a93e82a2d..5aa95d213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "html-reporter", - "version": "2.20.1", + "version": "2.20.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 56945eb87..3ea5a3aab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-reporter", - "version": "2.20.1", + "version": "2.20.2", "description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report", "scripts": { "lint": "eslint .", diff --git a/test/lib/gui/tool-runner-factory/hermione/index.js b/test/lib/gui/tool-runner-factory/hermione/index.js new file mode 100644 index 000000000..022df19f6 --- /dev/null +++ b/test/lib/gui/tool-runner-factory/hermione/index.js @@ -0,0 +1,99 @@ +'use strict'; + +const _ = require('lodash'); +const proxyquire = require('proxyquire'); +const ReportBuilder = require('lib/report-builder-factory/report-builder'); +const {stubTool} = require('test/utils'); + +describe('lib/gui/tool-runner-factory/hermione/index', () => { + const sandbox = sinon.createSandbox(); + let reportBuilder; + let ToolGuiReporter; + + const mkTestCollection_ = (testsTree = {}) => { + return {eachTest: (cb) => _.forEach(testsTree, cb)}; + }; + + const stubTest_ = (opts) => { + return _.defaults(opts, {id: () => 'default-id'}); + }; + + const mkToolCliOpts_ = (globalCliOpts = {name: () => 'hermione'}, guiCliOpts = {}) => { + return {program: globalCliOpts, options: guiCliOpts}; + }; + const mkPluginConfig_ = (config = {}) => { + const pluginConfig = _.defaults(config, {path: 'default-path'}); + return {pluginConfig}; + }; + + const initGuiReporter = (hermione, opts = {}) => { + opts = _.defaults(opts, { + paths: [], + configs: {} + }); + + const configs = _.defaults(opts.configs, mkToolCliOpts_(), mkPluginConfig_()); + + return ToolGuiReporter.create(opts.paths, hermione, configs); + }; + + beforeEach(() => { + reportBuilder = sinon.createStubInstance(ReportBuilder); + sandbox.stub(ReportBuilder, 'create').returns(reportBuilder); + reportBuilder.getResult.returns({}); + + ToolGuiReporter = proxyquire(`lib/gui/tool-runner-factory/hermione`, { + './report-subscriber': sandbox.stub() + }); + }); + + afterEach(() => sandbox.restore()); + + describe('initialize', () => { + it('should not add disabled test to report', () => { + const hermione = stubTool(); + hermione.readTests.resolves(mkTestCollection_({bro: stubTest_({disabled: true})})); + + const gui = initGuiReporter(hermione, {paths: ['foo']}); + + return gui.initialize() + .then(() => { + assert.notCalled(reportBuilder.addSkipped); + assert.notCalled(reportBuilder.addIdle); + }); + }); + + it('should not add silently skipped test to report', () => { + const hermione = stubTool(); + hermione.readTests.resolves(mkTestCollection_({bro: stubTest_({silentSkip: true})})); + + const gui = initGuiReporter(hermione, {paths: ['foo']}); + + return gui.initialize() + .then(() => { + assert.notCalled(reportBuilder.addSkipped); + assert.notCalled(reportBuilder.addIdle); + }); + }); + + it('should add skipped test to report', () => { + const hermione = stubTool(); + hermione.readTests.resolves(mkTestCollection_({bro: stubTest_({pending: true})})); + + const gui = initGuiReporter(hermione, {paths: ['foo']}); + + return gui.initialize() + .then(() => assert.calledOnce(reportBuilder.addSkipped)); + }); + + it('should add idle test to report', () => { + const hermione = stubTool(); + hermione.readTests.resolves(mkTestCollection_({bro: stubTest_()})); + + const gui = initGuiReporter(hermione, {paths: ['foo']}); + + return gui.initialize() + .then(() => assert.calledOnce(reportBuilder.addIdle)); + }); + }); +});