@@ -66,7 +66,7 @@ function NyanCat(runner, options) {
66
66
runner . once ( EVENT_RUN_END , function ( ) {
67
67
Base . cursor . show ( ) ;
68
68
for ( var i = 0 ; i < self . numberOfLines ; i ++ ) {
69
- write ( '\n' ) ;
69
+ process . stdout . write ( '\n' ) ;
70
70
}
71
71
self . epilogue ( ) ;
72
72
} ) ;
@@ -102,15 +102,15 @@ NyanCat.prototype.drawScoreboard = function () {
102
102
var stats = this . stats ;
103
103
104
104
function draw ( type , n ) {
105
- write ( ' ' ) ;
106
- write ( Base . color ( type , n ) ) ;
107
- write ( '\n' ) ;
105
+ process . stdout . write ( ' ' ) ;
106
+ process . stdout . write ( Base . color ( type , n ) ) ;
107
+ process . stdout . write ( '\n' ) ;
108
108
}
109
109
110
110
draw ( 'green' , stats . passes ) ;
111
111
draw ( 'fail' , stats . failures ) ;
112
112
draw ( 'pending' , stats . pending ) ;
113
- write ( '\n' ) ;
113
+ process . stdout . write ( '\n' ) ;
114
114
115
115
this . cursorUp ( this . numberOfLines ) ;
116
116
} ;
@@ -144,9 +144,9 @@ NyanCat.prototype.drawRainbow = function () {
144
144
var self = this ;
145
145
146
146
this . trajectories . forEach ( function ( line ) {
147
- write ( '\u001b[' + self . scoreboardWidth + 'C' ) ;
148
- write ( line . join ( '' ) ) ;
149
- write ( '\n' ) ;
147
+ process . stdout . write ( '\u001b[' + self . scoreboardWidth + 'C' ) ;
148
+ process . stdout . write ( line . join ( '' ) ) ;
149
+ process . stdout . write ( '\n' ) ;
150
150
} ) ;
151
151
152
152
this . cursorUp ( this . numberOfLines ) ;
@@ -163,25 +163,25 @@ NyanCat.prototype.drawNyanCat = function () {
163
163
var dist = '\u001b[' + startWidth + 'C' ;
164
164
var padding = '' ;
165
165
166
- write ( dist ) ;
167
- write ( '_,------,' ) ;
168
- write ( '\n' ) ;
166
+ process . stdout . write ( dist ) ;
167
+ process . stdout . write ( '_,------,' ) ;
168
+ process . stdout . write ( '\n' ) ;
169
169
170
- write ( dist ) ;
170
+ process . stdout . write ( dist ) ;
171
171
padding = self . tick ? ' ' : ' ' ;
172
- write ( '_|' + padding + '/\\_/\\ ' ) ;
173
- write ( '\n' ) ;
172
+ process . stdout . write ( '_|' + padding + '/\\_/\\ ' ) ;
173
+ process . stdout . write ( '\n' ) ;
174
174
175
- write ( dist ) ;
175
+ process . stdout . write ( dist ) ;
176
176
padding = self . tick ? '_' : '__' ;
177
177
var tail = self . tick ? '~' : '^' ;
178
- write ( tail + '|' + padding + this . face ( ) + ' ' ) ;
179
- write ( '\n' ) ;
178
+ process . stdout . write ( tail + '|' + padding + this . face ( ) + ' ' ) ;
179
+ process . stdout . write ( '\n' ) ;
180
180
181
- write ( dist ) ;
181
+ process . stdout . write ( dist ) ;
182
182
padding = self . tick ? ' ' : ' ' ;
183
- write ( padding + '"" "" ' ) ;
184
- write ( '\n' ) ;
183
+ process . stdout . write ( padding + '"" "" ' ) ;
184
+ process . stdout . write ( '\n' ) ;
185
185
186
186
this . cursorUp ( this . numberOfLines ) ;
187
187
} ;
@@ -213,7 +213,7 @@ NyanCat.prototype.face = function () {
213
213
*/
214
214
215
215
NyanCat . prototype . cursorUp = function ( n ) {
216
- write ( '\u001b[' + n + 'A' ) ;
216
+ process . stdout . write ( '\u001b[' + n + 'A' ) ;
217
217
} ;
218
218
219
219
/**
@@ -224,7 +224,7 @@ NyanCat.prototype.cursorUp = function (n) {
224
224
*/
225
225
226
226
NyanCat . prototype . cursorDown = function ( n ) {
227
- write ( '\u001b[' + n + 'B' ) ;
227
+ process . stdout . write ( '\u001b[' + n + 'B' ) ;
228
228
} ;
229
229
230
230
/**
@@ -264,13 +264,4 @@ NyanCat.prototype.rainbowify = function (str) {
264
264
return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m' ;
265
265
} ;
266
266
267
- /**
268
- * Stdout helper.
269
- *
270
- * @param {string } string A message to write to stdout.
271
- */
272
- function write ( string ) {
273
- process . stdout . write ( string ) ;
274
- }
275
-
276
267
NyanCat . description = '"nyan cat"' ;
0 commit comments