aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test-utils/failedTestReport.js
blob: 9520cc9c99a2d7cca8e93627d0650742ff754eb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var stdin = process.stdin;
var inputJSON = '';
var startJSON = false;
stdin.resume();
stdin.setEncoding('utf8');

stdin.on('data', function (chunk) {
	if (chunk.startsWith('{')) {
		startJSON = true;
	}
	if (startJSON) {
		inputJSON += chunk;
	}
});

stdin.on('end', function () {
	let report = JSON.parse(inputJSON);
	if (!report.numFailedTestSuites) {
		return;
	} else {
		console.log('--------------------------------');
		console.log('Failure Summary: \n');
	}
	report.testResults.forEach((suite) => {
		if(suite.status == 'failed') {
			console.log('Suite: ' + suite.name);
			suite.assertionResults.forEach((test) => {
				if (test.status === 'failed') {
					console.log('\tTest: ' + test.title);
				}
			});
		}
	});
});