@@ -35,23 +35,28 @@ const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors']
35
35
expectedAssertionsNumberError,
36
36
isExpectingAssertions,
37
37
isExpectingAssertionsError,
38
+ matcherHintOptions,
38
39
} = getState ( ) ;
39
40
41
+ const expectedColor = matcherHintOptions ?. expectedColor ?? EXPECTED_COLOR ;
42
+ const receivedColor = matcherHintOptions ?. receivedColor ?? RECEIVED_COLOR ;
43
+
40
44
resetAssertionsLocalState ( ) ;
41
45
42
46
if (
43
47
typeof expectedAssertionsNumber === 'number' &&
44
48
assertionCalls !== expectedAssertionsNumber
45
49
) {
46
- const numOfAssertionsExpected = EXPECTED_COLOR (
50
+ const numOfAssertionsExpected = expectedColor (
47
51
pluralize ( 'assertion' , expectedAssertionsNumber ) ,
48
52
) ;
49
53
50
54
expectedAssertionsNumberError ! . message =
51
55
`${ matcherHint ( '.assertions' , '' , expectedAssertionsNumber . toString ( ) , {
56
+ ...matcherHintOptions ,
52
57
isDirectExpectCall : true ,
53
58
} ) } \n\n` +
54
- `Expected ${ numOfAssertionsExpected } to be called but received ${ RECEIVED_COLOR (
59
+ `Expected ${ numOfAssertionsExpected } to be called but received ${ receivedColor (
55
60
pluralize ( 'assertion call' , assertionCalls || 0 ) ,
56
61
) } .`;
57
62
@@ -62,14 +67,17 @@ const extractExpectedAssertionsErrors: Expect['extractExpectedAssertionsErrors']
62
67
} ) ;
63
68
}
64
69
if ( isExpectingAssertions && assertionCalls === 0 ) {
65
- const expected = EXPECTED_COLOR ( 'at least one assertion' ) ;
66
- const received = RECEIVED_COLOR ( 'received none' ) ;
70
+ const expected = expectedColor ( 'at least one assertion' ) ;
71
+ const received = receivedColor ( 'received none' ) ;
67
72
68
73
isExpectingAssertionsError ! . message = `${ matcherHint (
69
74
'.hasAssertions' ,
70
75
'' ,
71
76
'' ,
72
- { isDirectExpectCall : true } ,
77
+ {
78
+ ...matcherHintOptions ,
79
+ isDirectExpectCall : true ,
80
+ } ,
73
81
) } \n\nExpected ${ expected } to be called but ${ received } .`;
74
82
75
83
result . push ( {
0 commit comments