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);
				}
			});
		}
	});
});