1- import { assertTypes , getColors } from '@vitest/utils'
1+ import { assertTypes } from '@vitest/utils'
2+ import c from 'tinyrainbow'
23import type { Constructable } from '@vitest/utils'
34import type { MockInstance , MockResult , MockSettledResult } from '@vitest/spy'
45import { isMockFunction } from '@vitest/spy'
@@ -35,7 +36,6 @@ declare class DOMTokenList {
3536// Jest Expect Compact
3637export const JestChaiExpect : ChaiPlugin = ( chai , utils ) => {
3738 const { AssertionError } = chai
38- const c = ( ) => getColors ( )
3939 const customTesters = getCustomEqualityTesters ( )
4040
4141 function def (
@@ -530,10 +530,10 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
530530 showActualCall ?: any ,
531531 ) => {
532532 if ( spy . mock . calls ) {
533- msg += c ( ) . gray (
533+ msg += c . gray (
534534 `\n\nReceived: \n\n${ spy . mock . calls
535535 . map ( ( callArg , i ) => {
536- let methodCall = c ( ) . bold (
536+ let methodCall = c . bold (
537537 ` ${ ordinalOf ( i + 1 ) } ${ spy . getMockName ( ) } call:\n\n` ,
538538 )
539539 if ( showActualCall ) {
@@ -554,8 +554,8 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
554554 . join ( '\n' ) } `,
555555 )
556556 }
557- msg += c ( ) . gray (
558- `\n\nNumber of calls: ${ c ( ) . bold ( spy . mock . calls . length ) } \n` ,
557+ msg += c . gray (
558+ `\n\nNumber of calls: ${ c . bold ( spy . mock . calls . length ) } \n` ,
559559 )
560560 return msg
561561 }
@@ -565,10 +565,10 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
565565 msg : string ,
566566 showActualReturn ?: any ,
567567 ) => {
568- msg += c ( ) . gray (
568+ msg += c . gray (
569569 `\n\nReceived: \n\n${ results
570570 . map ( ( callReturn , i ) => {
571- let methodCall = c ( ) . bold (
571+ let methodCall = c . bold (
572572 ` ${ ordinalOf ( i + 1 ) } ${ spy . getMockName ( ) } call return:\n\n` ,
573573 )
574574 if ( showActualReturn ) {
@@ -588,8 +588,8 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
588588 } )
589589 . join ( '\n' ) } `,
590590 )
591- msg += c ( ) . gray (
592- `\n\nNumber of calls: ${ c ( ) . bold ( spy . mock . calls . length ) } \n` ,
591+ msg += c . gray (
592+ `\n\nNumber of calls: ${ c . bold ( spy . mock . calls . length ) } \n` ,
593593 )
594594 return msg
595595 }
0 commit comments