Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
fix(vflat): verbose reporter does not show session id
Browse files Browse the repository at this point in the history
  • Loading branch information
sipayRT committed May 17, 2018
1 parent 9727dd9 commit 187f8e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
16 changes: 7 additions & 9 deletions lib/reporters/flat-factory/flat-verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ const Flat = require('./flat');

module.exports = class FlatVerbose extends Flat {
_formatStateInfo(result) {
const suite = result.suite.path.join(' ');
const {suite, state, browserId, sessionId = 'unknown session id'} = result;
const suiteFullname = suite.path.join(' ');
const stateName = state ? `${chalk.underline(state.name)}` : '';

const state = result.state
? `${chalk.underline(result.state.name)}`
: '';

const session = result.suite.skipped
const session = suite.shouldSkip(browserId)
? ''
: `: ${chalk.blue(result.sessionId || 'unknown session id')}`;
: `: ${chalk.blue(sessionId)}`;

const browser = `[${chalk.yellow(result.browserId)}${session}]`;
const browserInfo = `[${chalk.yellow(browserId)}${session}]`;

return _([suite, state, browser]).compact().join(' ');
return _([suiteFullname, stateName, browserInfo]).compact().join(' ');
}
};
13 changes: 10 additions & 3 deletions test/unit/reporters/flat-factory/flat-verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ describe('Reporter#FlatVerbose', () => {

it('should correctly do the rendering', () => {
const test = {
suite: {path: ['block', 'size', 'big']},
suite: {
path: ['block', 'size', 'big'],
shouldSkip: () => false
},
state: {name: 'hover'},
browserId: 'chrome',
sessionId: '0fc23des'
Expand All @@ -47,9 +50,13 @@ describe('Reporter#FlatVerbose', () => {

it('should not render session identifier for skipped tests', () => {
const test = {
suite: {path: ['some-path'], skipped: {}},
suite: {
path: ['some-path'], skipped: {},
shouldSkip: () => true
},
state: {name: 'some-name'},
browserId: 'chrome'
browserId: 'chrome',
sessionId: '0fc23des'
};

assert.equal(getTestLog(test), 'some-path some-name [chrome]');
Expand Down

0 comments on commit 187f8e8

Please sign in to comment.