Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
25
node_modules/ava/lib/reporters/format-serialized-error.js
generated
vendored
25
node_modules/ava/lib/reporters/format-serialized-error.js
generated
vendored
|
|
@ -1,27 +1,16 @@
|
|||
'use strict';
|
||||
const trimOffNewlines = require('trim-off-newlines');
|
||||
const chalk = require('../chalk').get();
|
||||
export default function formatSerializedError(error) {
|
||||
const printMessage = error.values.length === 0
|
||||
? Boolean(error.message)
|
||||
: !error.values[0].label.startsWith(error.message);
|
||||
|
||||
function formatSerializedError(error) {
|
||||
const printMessage = error.values.length === 0 ?
|
||||
Boolean(error.message) :
|
||||
!error.values[0].label.startsWith(error.message);
|
||||
|
||||
if (error.statements.length === 0 && error.values.length === 0) {
|
||||
if (error.values.length === 0) {
|
||||
return {formatted: null, printMessage};
|
||||
}
|
||||
|
||||
let formatted = '';
|
||||
for (const value of error.values) {
|
||||
formatted += `${value.label}\n\n${trimOffNewlines(value.formatted)}\n\n`;
|
||||
formatted += `${value.label}\n\n${value.formatted}\n\n`;
|
||||
}
|
||||
|
||||
for (const statement of error.statements) {
|
||||
formatted += `${statement[0]}\n${chalk.grey('=>')} ${trimOffNewlines(statement[1])}\n\n`;
|
||||
}
|
||||
|
||||
formatted = trimOffNewlines(formatted);
|
||||
return {formatted, printMessage};
|
||||
return {formatted: formatted.trim(), printMessage};
|
||||
}
|
||||
|
||||
module.exports = formatSerializedError;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue