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

Commit 187f8e8

Browse files
committed
fix(vflat): verbose reporter does not show session id
1 parent 9727dd9 commit 187f8e8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

lib/reporters/flat-factory/flat-verbose.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ const Flat = require('./flat');
66

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

11-
const state = result.state
12-
? `${chalk.underline(result.state.name)}`
13-
: '';
14-
15-
const session = result.suite.skipped
13+
const session = suite.shouldSkip(browserId)
1614
? ''
17-
: `: ${chalk.blue(result.sessionId || 'unknown session id')}`;
15+
: `: ${chalk.blue(sessionId)}`;
1816

19-
const browser = `[${chalk.yellow(result.browserId)}${session}]`;
17+
const browserInfo = `[${chalk.yellow(browserId)}${session}]`;
2018

21-
return _([suite, state, browser]).compact().join(' ');
19+
return _([suiteFullname, stateName, browserInfo]).compact().join(' ');
2220
}
2321
};

test/unit/reporters/flat-factory/flat-verbose.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ describe('Reporter#FlatVerbose', () => {
3636

3737
it('should correctly do the rendering', () => {
3838
const test = {
39-
suite: {path: ['block', 'size', 'big']},
39+
suite: {
40+
path: ['block', 'size', 'big'],
41+
shouldSkip: () => false
42+
},
4043
state: {name: 'hover'},
4144
browserId: 'chrome',
4245
sessionId: '0fc23des'
@@ -47,9 +50,13 @@ describe('Reporter#FlatVerbose', () => {
4750

4851
it('should not render session identifier for skipped tests', () => {
4952
const test = {
50-
suite: {path: ['some-path'], skipped: {}},
53+
suite: {
54+
path: ['some-path'], skipped: {},
55+
shouldSkip: () => true
56+
},
5157
state: {name: 'some-name'},
52-
browserId: 'chrome'
58+
browserId: 'chrome',
59+
sessionId: '0fc23des'
5360
};
5461

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

0 commit comments

Comments
 (0)