Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
testResults.forEach(testResult => {
if (testResult.status === 'failed') {
numFailingTests++;
} else if (testResult.status === 'pending') {
numPendingTests++;
} else if (testResult.status === 'todo') {
numTodoTests++;
} else {
numPassingTests++;
}
});
const testResult = {
...createEmptyTestResult(),
console: null,
failureMessage: formatResultsErrors(
testResults,
this._config,
this._globalConfig,
this._testPath,
),
numFailingTests,
numPassingTests,
numPendingTests,
numTodoTests,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
unmatched: 0,
updated: 0,
ancestorTitles,
duration: testResult.duration,
failureMessages: testResult.errors,
fullName: title
? ancestorTitles.concat(title).join(' ')
: ancestorTitles.join(' '),
invocations: testResult.invocations,
location: testResult.location,
numPassingAsserts: 0,
status,
title: testResult.testPath[testResult.testPath.length - 1],
};
},
);
let failureMessage = formatResultsErrors(
assertionResults,
config,
globalConfig,
testPath,
);
let testExecError;
if (runResult.unhandledErrors.length) {
testExecError = {
message: '',
stack: runResult.unhandledErrors.join('\n'),
};
failureMessage =
(failureMessage || '') +
'\n\n' +
runResult.unhandledErrors