Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 28, 2025
1 parent 6e7b815 commit 5298278
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class ErrorsPrinter {
*/
async #parseAssertionError(error: any): Promise<any> {
const parsedError = error
if (!('showDiff' in error) || error.showDiff) {
if (error.showDiff) {
console.error()
// const { actual, expected } = error
// const diff = jestDiff(expected, actual, {
Expand All @@ -79,33 +79,33 @@ export class ErrorsPrinter {
/**
* Displays the error stack for a given error
*/
// async #displayErrorStack(error: any) {
// // const ansiOutput = await new Youch().toANSI(error, {
// // frameSourceBuffer: this.#options.stackLinesCount,
// // })
// const ansiOutput = error
// console.error(ansiOutput)
// }
async #displayErrorStack(error: any) {
// const ansiOutput = await new Youch().toANSI(error, {
// frameSourceBuffer: this.#options.stackLinesCount,
// })
const ansiOutput = error
console.error(ansiOutput)
}

/**
* Display chai assertion error
*/
// async #displayAssertionError(error: any) {
// if (!('showDiff' in error) || error.showDiff) {
// console.error()
// // const { actual, expected } = error
// // const diff = jestDiff(expected, actual, {
// // expand: true,
// // includeChangeCounts: true,
// // })
// // console.error(diff)
// }
async #displayAssertionError(error: any) {
if (error.showDiff) {
console.error()
// const { actual, expected } = error
// const diff = jestDiff(expected, actual, {
// expand: true,
// includeChangeCounts: true,
// })
// console.error(diff)
}

// /**
// * Pretty print error stack
// */
// await this.#displayErrorStack(error)
// }
/**
* Pretty print error stack
*/
await this.#displayErrorStack(error)
}

/**
* Prints a section with heading and borders around it
Expand Down Expand Up @@ -171,15 +171,15 @@ export class ErrorsPrinter {
/**
* Assertion error
*/
// if ('actual' in error && 'expected' in error) {
// await this.#displayAssertionError(error)
// return
// }

// /**
// * Print all other errors using Youch
// */
// await this.#displayErrorStack(error)
if ('actual' in error && 'expected' in error) {
await this.#displayAssertionError(error)
return
}

/**
* Print all other errors using Youch
*/
await this.#displayErrorStack(error)
}

/**
Expand Down

0 comments on commit 5298278

Please sign in to comment.