Skip to content

Commit 50a49e4

Browse files
authored
Added tests for short console output
1 parent 771e44a commit 50a49e4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

__tests__/buildJsonResults.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,24 @@ describe('buildJsonResults', () => {
189189

190190
expect(jsonResults.testsuites[1].testsuite[1]['system-out']).not.toBeDefined();
191191
});
192+
193+
it('should show short console output if includeShortConsoleOutput is true', () => {
194+
const reportWithShortConsoleOutput = require('../__mocks__/test-with-console-output.json');
195+
const jsonResults = buildJsonResults(reportWithShortConsoleOutput, '/',
196+
Object.assign({}, constants.DEFAULT_OPTIONS, {
197+
includeShortConsoleOutput: "true"
198+
}));
199+
200+
expect(jsonResults.testsuites[1].testsuite[1]['system-out']._cdata).toEqual("[\n \"I am bar\",\n \"Some output here from a lib\"\n]");
201+
});
202+
203+
it('should NOT show short console output if includeShortConsoleOutput is not set or false', () => {
204+
const reportWithShortConsoleOutput = require('../__mocks__/test-with-console-output.json');
205+
const jsonResults = buildJsonResults(reportWithShortConsoleOutput, '/',
206+
Object.assign({}, constants.DEFAULT_OPTIONS, {
207+
includeShortConsoleOutput: "false"
208+
}));
209+
210+
expect(jsonResults.testsuites[1].testsuite[1]['system-out']).not.toBeDefined();
211+
});
192212
});

0 commit comments

Comments
 (0)