66 */
77
88import ansiEscapes = require( 'ansi-escapes' ) ;
9- import chalk = require ( 'chalk' ) ;
9+ import * as pico from 'picocolors' ;
1010import type { AggregatedResult , AssertionLocation } from '@jest/test-result' ;
1111import { pluralize , specialChars } from 'jest-util' ;
1212import { KEYS } from 'jest-watcher' ;
@@ -48,37 +48,35 @@ export default class SnapshotInteractiveMode {
4848 const numPass = this . _countPaths - this . _testAssertions . length ;
4949 const numRemaining = this . _countPaths - numPass - this . _skippedNum ;
5050
51- let stats = chalk . bold . dim (
52- `${ pluralize ( 'snapshot' , numRemaining ) } remaining` ,
51+ let stats = pico . bold (
52+ pico . dim ( `${ pluralize ( 'snapshot' , numRemaining ) } remaining` ) ,
5353 ) ;
5454 if ( numPass ) {
55- stats += `, ${ chalk . bold . green (
56- `${ pluralize ( 'snapshot' , numPass ) } updated` ,
55+ stats += `, ${ pico . bold (
56+ pico . green ( `${ pluralize ( 'snapshot' , numPass ) } updated` ) ,
5757 ) } `;
5858 }
5959 if ( this . _skippedNum ) {
60- stats += `, ${ chalk . bold . yellow (
61- `${ pluralize ( 'snapshot' , this . _skippedNum ) } skipped` ,
60+ stats += `, ${ pico . bold (
61+ pico . yellow ( `${ pluralize ( 'snapshot' , this . _skippedNum ) } skipped` ) ,
6262 ) } `;
6363 }
6464 const messages = [
65- `\n${ chalk . bold ( 'Interactive Snapshot Progress' ) } ` ,
65+ `\n${ pico . bold ( 'Interactive Snapshot Progress' ) } ` ,
6666 ARROW + stats ,
67- `\n${ chalk . bold ( 'Watch Usage' ) } ` ,
67+ `\n${ pico . bold ( 'Watch Usage' ) } ` ,
6868
69- `${ chalk . dim ( `${ ARROW } Press ` ) } u${ chalk . dim (
69+ `${ pico . dim ( `${ ARROW } Press ` ) } u${ pico . dim (
7070 ' to update failing snapshots for this test.' ,
7171 ) } `,
7272
73- `${ chalk . dim ( `${ ARROW } Press ` ) } s${ chalk . dim (
74- ' to skip the current test.' ,
75- ) } `,
73+ `${ pico . dim ( `${ ARROW } Press ` ) } s${ pico . dim ( ' to skip the current test.' ) } ` ,
7674
77- `${ chalk . dim ( `${ ARROW } Press ` ) } q${ chalk . dim (
75+ `${ pico . dim ( `${ ARROW } Press ` ) } q${ pico . dim (
7876 ' to quit Interactive Snapshot Mode.' ,
7977 ) } `,
8078
81- `${ chalk . dim ( `${ ARROW } Press ` ) } Enter${ chalk . dim (
79+ `${ pico . dim ( `${ ARROW } Press ` ) } Enter${ pico . dim (
8280 ' to trigger a test run.' ,
8381 ) } `,
8482 ] ;
@@ -90,29 +88,29 @@ export default class SnapshotInteractiveMode {
9088 this . _pipe . write ( CLEAR ) ;
9189 const numPass = this . _countPaths - this . _testAssertions . length ;
9290
93- let stats = chalk . bold . dim (
94- `${ pluralize ( 'snapshot' , this . _countPaths ) } reviewed` ,
91+ let stats = pico . bold (
92+ pico . dim ( `${ pluralize ( 'snapshot' , this . _countPaths ) } reviewed` ) ,
9593 ) ;
9694 if ( numPass ) {
97- stats += `, ${ chalk . bold . green (
98- `${ pluralize ( 'snapshot' , numPass ) } updated` ,
95+ stats += `, ${ pico . bold (
96+ pico . green ( `${ pluralize ( 'snapshot' , numPass ) } updated` ) ,
9997 ) } `;
10098 }
10199 if ( this . _skippedNum ) {
102- stats += `, ${ chalk . bold . yellow (
103- `${ pluralize ( 'snapshot' , this . _skippedNum ) } skipped` ,
100+ stats += `, ${ pico . bold (
101+ pico . yellow ( `${ pluralize ( 'snapshot' , this . _skippedNum ) } skipped` ) ,
104102 ) } `;
105103 }
106104 const messages = [
107- `\n${ chalk . bold ( 'Interactive Snapshot Result' ) } ` ,
105+ `\n${ pico . bold ( 'Interactive Snapshot Result' ) } ` ,
108106 ARROW + stats ,
109- `\n${ chalk . bold ( 'Watch Usage' ) } ` ,
107+ `\n${ pico . bold ( 'Watch Usage' ) } ` ,
110108
111- `${ chalk . dim ( `${ ARROW } Press ` ) } r${ chalk . dim (
109+ `${ pico . dim ( `${ ARROW } Press ` ) } r${ pico . dim (
112110 ' to restart Interactive Snapshot Mode.' ,
113111 ) } `,
114112
115- `${ chalk . dim ( `${ ARROW } Press ` ) } q${ chalk . dim (
113+ `${ pico . dim ( `${ ARROW } Press ` ) } q${ pico . dim (
116114 ' to quit Interactive Snapshot Mode.' ,
117115 ) } `,
118116 ] ;
@@ -124,20 +122,20 @@ export default class SnapshotInteractiveMode {
124122 this . _pipe . write ( CLEAR ) ;
125123 const numPass = this . _countPaths - this . _testAssertions . length ;
126124
127- let stats = chalk . bold . dim (
128- `${ pluralize ( 'snapshot' , this . _countPaths ) } reviewed` ,
125+ let stats = pico . bold (
126+ pico . dim ( `${ pluralize ( 'snapshot' , this . _countPaths ) } reviewed` ) ,
129127 ) ;
130128 if ( numPass ) {
131- stats += `, ${ chalk . bold . green (
132- `${ pluralize ( 'snapshot' , numPass ) } updated` ,
129+ stats += `, ${ pico . bold (
130+ pico . green ( `${ pluralize ( 'snapshot' , numPass ) } updated` ) ,
133131 ) } `;
134132 }
135133 const messages = [
136- `\n${ chalk . bold ( 'Interactive Snapshot Result' ) } ` ,
134+ `\n${ pico . bold ( 'Interactive Snapshot Result' ) } ` ,
137135 ARROW + stats ,
138- `\n${ chalk . bold ( 'Watch Usage' ) } ` ,
136+ `\n${ pico . bold ( 'Watch Usage' ) } ` ,
139137
140- `${ chalk . dim ( `${ ARROW } Press ` ) } Enter${ chalk . dim (
138+ `${ pico . dim ( `${ ARROW } Press ` ) } Enter${ pico . dim (
141139 ' to return to watch mode.' ,
142140 ) } `,
143141 ] ;
0 commit comments