@@ -73,179 +73,219 @@ const dumpHelp =
73
73
"`rescript dump` dumps the information for the target\n" ;
74
74
75
75
// Shows build help with --help arg
76
+ console . group ( "build --help" ) ;
76
77
let out = child_process . spawnSync ( `../../../rescript` , [ "build" , "--help" ] , {
77
78
encoding : "utf8" ,
78
79
cwd : __dirname ,
79
80
} ) ;
80
81
assert . equal ( out . stdout , buildHelp ) ;
81
82
assert . equal ( out . stderr , "" ) ;
82
83
assert . equal ( out . status , 0 ) ;
84
+ console . groupEnd ( ) ;
83
85
86
+ console . group ( "build -w --help" ) ;
84
87
out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-w" , "--help" ] , {
85
88
encoding : "utf8" ,
86
89
cwd : __dirname ,
87
90
} ) ;
88
91
assert . equal ( out . stdout , buildHelp ) ;
89
92
assert . equal ( out . stderr , "" ) ;
90
93
assert . equal ( out . status , 0 ) ;
94
+ console . groupEnd ( ) ;
91
95
96
+ console . group ( "-w --help" ) ;
92
97
out = child_process . spawnSync ( `../../../rescript` , [ "-w" , "--help" ] , {
93
98
encoding : "utf8" ,
94
99
cwd : __dirname ,
95
100
} ) ;
96
101
assert . equal ( out . stdout , cliHelp ) ;
97
102
assert . equal ( out . stderr , "" ) ;
98
103
assert . equal ( out . status , 0 ) ;
104
+ console . groupEnd ( ) ;
99
105
100
106
// Shows cli help with --help arg even if there are invalid arguments after it
107
+ console . group ( "--help -w" ) ;
101
108
out = child_process . spawnSync ( `../../../rescript` , [ "--help" , "-w" ] , {
102
109
encoding : "utf8" ,
103
110
cwd : __dirname ,
104
111
} ) ;
105
112
assert . equal ( out . stdout , cliHelp ) ;
106
113
assert . equal ( out . stderr , "" ) ;
107
114
assert . equal ( out . status , 0 ) ;
115
+ console . groupEnd ( ) ;
108
116
109
117
// Shows build help with -h arg
118
+ console . group ( "build -h" ) ;
110
119
out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-h" ] , {
111
120
encoding : "utf8" ,
112
121
cwd : __dirname ,
113
122
} ) ;
114
123
assert . equal ( out . stdout , buildHelp ) ;
115
124
assert . equal ( out . stderr , "" ) ;
116
125
assert . equal ( out . status , 0 ) ;
126
+ console . groupEnd ( ) ;
117
127
118
128
// Exits with build help with unknown arg
129
+ console . group ( "build -foo" ) ;
119
130
out = child_process . spawnSync ( `../../../rescript` , [ "build" , "-foo" ] , {
120
131
encoding : "utf8" ,
121
132
cwd : __dirname ,
122
133
} ) ;
123
134
assert . equal ( out . stdout , "" ) ;
124
135
assert . equal ( out . stderr , 'Error: Unknown option "-foo".\n' + buildHelp ) ;
125
136
assert . equal ( out . status , 2 ) ;
137
+ console . groupEnd ( ) ;
126
138
127
139
// Shows cli help with --help arg
140
+ console . group ( "--help" ) ;
128
141
out = child_process . spawnSync ( `../../../rescript` , [ "--help" ] , {
129
142
encoding : "utf8" ,
130
143
cwd : __dirname ,
131
144
} ) ;
132
145
assert . equal ( out . stdout , cliHelp ) ;
133
146
assert . equal ( out . stderr , "" ) ;
134
147
assert . equal ( out . status , 0 ) ;
148
+ console . groupEnd ( ) ;
135
149
136
150
// Shows cli help with -h arg
151
+ console . group ( "-h" ) ;
137
152
out = child_process . spawnSync ( `../../../rescript` , [ "-h" ] , {
138
153
encoding : "utf8" ,
139
154
cwd : __dirname ,
140
155
} ) ;
141
156
assert . equal ( out . stdout , cliHelp ) ;
142
157
assert . equal ( out . stderr , "" ) ;
143
158
assert . equal ( out . status , 0 ) ;
159
+ console . groupEnd ( ) ;
144
160
145
161
// Shows cli help with help command
162
+ console . group ( "help" ) ;
146
163
out = child_process . spawnSync ( `../../../rescript` , [ "help" ] , {
147
164
encoding : "utf8" ,
148
165
cwd : __dirname ,
149
166
} ) ;
150
167
assert . equal ( out . stdout , cliHelp ) ;
151
168
assert . equal ( out . stderr , "" ) ;
152
169
assert . equal ( out . status , 0 ) ;
170
+ console . groupEnd ( ) ;
153
171
154
172
// Exits with cli help with unknown command
173
+ console . group ( "built" ) ;
155
174
out = child_process . spawnSync ( `../../../rescript` , [ "built" ] , {
156
175
encoding : "utf8" ,
157
176
cwd : __dirname ,
158
177
} ) ;
159
178
assert . equal ( out . stdout , "" ) ;
160
179
assert . equal ( out . stderr , `Error: Unknown command "built".\n` + cliHelp ) ;
161
180
assert . equal ( out . status , 2 ) ;
181
+ console . groupEnd ( ) ;
162
182
163
183
// Exits with build help with unknown args
184
+ console . group ( "-foo" ) ;
164
185
out = child_process . spawnSync ( `../../../rescript` , [ "-foo" ] , {
165
186
encoding : "utf8" ,
166
187
cwd : __dirname ,
167
188
} ) ;
168
189
assert . equal ( out . stdout , "" ) ;
169
190
assert . equal ( out . stderr , 'Error: Unknown option "-foo".\n' + buildHelp ) ;
170
191
assert . equal ( out . status , 2 ) ;
192
+ console . groupEnd ( ) ;
171
193
172
194
// Shows clean help with --help arg
195
+ console . group ( "clean --help" ) ;
173
196
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "--help" ] , {
174
197
encoding : "utf8" ,
175
198
cwd : __dirname ,
176
199
} ) ;
177
200
assert . equal ( out . stdout , cleanHelp ) ;
178
201
assert . equal ( out . stderr , "" ) ;
179
202
assert . equal ( out . status , 0 ) ;
203
+ console . groupEnd ( ) ;
180
204
181
205
// Shows clean help with -h arg
206
+ console . group ( "clean -h" ) ;
182
207
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "-h" ] , {
183
208
encoding : "utf8" ,
184
209
cwd : __dirname ,
185
210
} ) ;
186
211
assert . equal ( out . stdout , cleanHelp ) ;
187
212
assert . equal ( out . stderr , "" ) ;
188
213
assert . equal ( out . status , 0 ) ;
214
+ console . groupEnd ( ) ;
189
215
190
216
// Exits with clean help with unknown arg
217
+ console . group ( "clean -foo" ) ;
191
218
out = child_process . spawnSync ( `../../../rescript` , [ "clean" , "-foo" ] , {
192
219
encoding : "utf8" ,
193
220
cwd : __dirname ,
194
221
} ) ;
195
222
assert . equal ( out . stdout , "" ) ;
196
223
assert . equal ( out . stderr , 'Error: Unknown option "-foo".\n' + cleanHelp ) ;
197
224
assert . equal ( out . status , 2 ) ;
225
+ console . groupEnd ( ) ;
198
226
199
227
// Shows format help with --help arg
228
+ console . group ( "format --help" ) ;
200
229
out = child_process . spawnSync ( `../../../rescript` , [ "format" , "--help" ] , {
201
230
encoding : "utf8" ,
202
231
cwd : __dirname ,
203
232
} ) ;
204
233
assert . equal ( out . stdout , formatHelp ) ;
205
234
assert . equal ( out . stderr , "" ) ;
206
235
assert . equal ( out . status , 0 ) ;
236
+ console . groupEnd ( ) ;
207
237
208
238
// Shows format help with -h arg
239
+ console . group ( "format -h" ) ;
209
240
out = child_process . spawnSync ( `../../../rescript` , [ "format" , "-h" ] , {
210
241
encoding : "utf8" ,
211
242
cwd : __dirname ,
212
243
} ) ;
213
244
assert . equal ( out . stdout , formatHelp ) ;
214
245
assert . equal ( out . stderr , "" ) ;
215
246
assert . equal ( out . status , 0 ) ;
247
+ console . groupEnd ( ) ;
216
248
217
249
// Shows convert help with --help arg
250
+ console . group ( "convert --help" ) ;
218
251
out = child_process . spawnSync ( `../../../rescript` , [ "convert" , "--help" ] , {
219
252
encoding : "utf8" ,
220
253
cwd : __dirname ,
221
254
} ) ;
222
255
assert . equal ( out . stdout , convertHelp ) ;
223
256
assert . equal ( out . stderr , "" ) ;
224
257
assert . equal ( out . status , 0 ) ;
258
+ console . groupEnd ( ) ;
225
259
226
260
// Shows convert help with -h arg
261
+ console . group ( "convert -h" ) ;
227
262
out = child_process . spawnSync ( `../../../rescript` , [ "convert" , "-h" ] , {
228
263
encoding : "utf8" ,
229
264
cwd : __dirname ,
230
265
} ) ;
231
266
assert . equal ( out . stdout , convertHelp ) ;
232
267
assert . equal ( out . stderr , "" ) ;
233
268
assert . equal ( out . status , 0 ) ;
269
+ console . groupEnd ( ) ;
234
270
235
271
// Shows dump help with --help arg
272
+ console . group ( "dump --help" ) ;
236
273
out = child_process . spawnSync ( `../../../rescript` , [ "dump" , "--help" ] , {
237
274
encoding : "utf8" ,
238
275
cwd : __dirname ,
239
276
} ) ;
240
277
assert . equal ( out . stdout , dumpHelp ) ;
241
278
assert . equal ( out . stderr , "" ) ;
242
279
assert . equal ( out . status , 0 ) ;
280
+ console . groupEnd ( ) ;
243
281
244
282
// Shows dump help with -h arg
283
+ console . group ( "dump -h" ) ;
245
284
out = child_process . spawnSync ( `../../../rescript` , [ "dump" , "-h" ] , {
246
285
encoding : "utf8" ,
247
286
cwd : __dirname ,
248
287
} ) ;
249
288
assert . equal ( out . stdout , dumpHelp ) ;
250
289
assert . equal ( out . stderr , "" ) ;
251
290
assert . equal ( out . status , 0 ) ;
291
+ console . groupEnd ( ) ;
0 commit comments