@@ -31,191 +31,156 @@ describe("[argument-placeholders]", () => {
31
31
describe ( "If arguments preceded by '--' are nothing, '{1}' should be empty:" , ( ) => {
32
32
it ( "Node API" , ( ) =>
33
33
nodeApi ( "test-task:dump {1}" )
34
- . then ( ( ) => assert ( result ( ) === "[]" ) )
35
- )
34
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
36
35
37
36
it ( "npm-run-all command" , ( ) =>
38
37
runAll ( [ "test-task:dump {1}" ] )
39
- . then ( ( ) => assert ( result ( ) === "[]" ) )
40
- )
38
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
41
39
42
40
it ( "npm-run-all command (only '--' exists)" , ( ) =>
43
41
runAll ( [ "test-task:dump {1}" , "--" ] )
44
- . then ( ( ) => assert ( result ( ) === "[]" ) )
45
- )
42
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
46
43
47
44
it ( "run-s command" , ( ) =>
48
45
runSeq ( [ "test-task:dump {1}" ] )
49
- . then ( ( ) => assert ( result ( ) === "[]" ) )
50
- )
46
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
51
47
52
48
it ( "run-s command (only '--' exists)" , ( ) =>
53
49
runSeq ( [ "test-task:dump {1}" , "--" ] )
54
- . then ( ( ) => assert ( result ( ) === "[]" ) )
55
- )
50
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
56
51
57
52
it ( "run-p command" , ( ) =>
58
53
runPar ( [ "test-task:dump {1}" ] )
59
- . then ( ( ) => assert ( result ( ) === "[]" ) )
60
- )
54
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
61
55
62
56
it ( "run-p command (only '--' exists)" , ( ) =>
63
57
runPar ( [ "test-task:dump {1}" , "--" ] )
64
- . then ( ( ) => assert ( result ( ) === "[]" ) )
65
- )
58
+ . then ( ( ) => assert ( result ( ) === "[]" ) ) )
66
59
} )
67
60
68
61
describe ( "'{1}' should be replaced by the 1st argument preceded by '--':" , ( ) => {
69
62
it ( "Node API" , ( ) =>
70
63
nodeApi ( "test-task:dump {1}" , { arguments : [ "1st" , "2nd" ] } )
71
- . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) )
72
- )
64
+ . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) ) )
73
65
74
66
it ( "npm-run-all command" , ( ) =>
75
67
runAll ( [ "test-task:dump {1}" , "--" , "1st" , "2nd" ] )
76
- . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) )
77
- )
68
+ . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) ) )
78
69
79
70
it ( "run-s command" , ( ) =>
80
71
runSeq ( [ "test-task:dump {1}" , "--" , "1st" , "2nd" ] )
81
- . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) )
82
- )
72
+ . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) ) )
83
73
84
74
it ( "run-p command" , ( ) =>
85
75
runPar ( [ "test-task:dump {1}" , "--" , "1st" , "2nd" ] )
86
- . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) )
87
- )
76
+ . then ( ( ) => assert ( result ( ) === "[\"1st\"]" ) ) )
88
77
} )
89
78
90
79
describe ( "'{2}' should be replaced by the 2nd argument preceded by '--':" , ( ) => {
91
80
it ( "Node API" , ( ) =>
92
81
nodeApi ( "test-task:dump {2}" , { arguments : [ "1st" , "2nd" ] } )
93
- . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) )
94
- )
82
+ . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) ) )
95
83
96
84
it ( "npm-run-all command" , ( ) =>
97
85
runAll ( [ "test-task:dump {2}" , "--" , "1st" , "2nd" ] )
98
- . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) )
99
- )
86
+ . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) ) )
100
87
101
88
it ( "run-s command" , ( ) =>
102
89
runSeq ( [ "test-task:dump {2}" , "--" , "1st" , "2nd" ] )
103
- . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) )
104
- )
90
+ . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) ) )
105
91
106
92
it ( "run-p command" , ( ) =>
107
93
runPar ( [ "test-task:dump {2}" , "--" , "1st" , "2nd" ] )
108
- . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) )
109
- )
94
+ . then ( ( ) => assert ( result ( ) === "[\"2nd\"]" ) ) )
110
95
} )
111
96
112
97
describe ( "'{@}' should be replaced by the every argument preceded by '--':" , ( ) => {
113
98
it ( "Node API" , ( ) =>
114
99
nodeApi ( "test-task:dump {@}" , { arguments : [ "1st" , "2nd" ] } )
115
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) )
116
- )
100
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) ) )
117
101
118
102
it ( "npm-run-all command" , ( ) =>
119
103
runAll ( [ "test-task:dump {@}" , "--" , "1st" , "2nd" ] )
120
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) )
121
- )
104
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) ) )
122
105
123
106
it ( "run-s command" , ( ) =>
124
107
runSeq ( [ "test-task:dump {@}" , "--" , "1st" , "2nd" ] )
125
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) )
126
- )
108
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) ) )
127
109
128
110
it ( "run-p command" , ( ) =>
129
111
runPar ( [ "test-task:dump {@}" , "--" , "1st" , "2nd" ] )
130
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) )
131
- )
112
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\"]" ) ) )
132
113
} )
133
114
134
115
describe ( "'{*}' should be replaced by the all arguments preceded by '--':" , ( ) => {
135
116
it ( "Node API" , ( ) =>
136
117
nodeApi ( "test-task:dump {*}" , { arguments : [ "1st" , "2nd" ] } )
137
- . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) )
138
- )
118
+ . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) ) )
139
119
140
120
it ( "npm-run-all command" , ( ) =>
141
121
runAll ( [ "test-task:dump {*}" , "--" , "1st" , "2nd" ] )
142
- . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) )
143
- )
122
+ . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) ) )
144
123
145
124
it ( "run-s command" , ( ) =>
146
125
runSeq ( [ "test-task:dump {*}" , "--" , "1st" , "2nd" ] )
147
- . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) )
148
- )
126
+ . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) ) )
149
127
150
128
it ( "run-p command" , ( ) =>
151
129
runPar ( [ "test-task:dump {*}" , "--" , "1st" , "2nd" ] )
152
- . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) )
153
- )
130
+ . then ( ( ) => assert ( result ( ) === "[\"1st 2nd\"]" ) ) )
154
131
} )
155
132
156
133
describe ( "Every '{1}', '{2}', '{@}' and '{*}' should be replaced by the arguments preceded by '--':" , ( ) => {
157
134
it ( "Node API" , ( ) =>
158
135
nodeApi ( "test-task:dump {1} {2} {3} {@} {*}" , { arguments : [ "1st" , "2nd" ] } )
159
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) )
160
- )
136
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) ) )
161
137
162
138
it ( "npm-run-all command" , ( ) =>
163
139
runAll ( [ "test-task:dump {1} {2} {3} {@} {*}" , "--" , "1st" , "2nd" ] )
164
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) )
165
- )
140
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) ) )
166
141
167
142
it ( "run-s command" , ( ) =>
168
143
runSeq ( [ "test-task:dump {1} {2} {3} {@} {*}" , "--" , "1st" , "2nd" ] )
169
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) )
170
- )
144
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) ) )
171
145
172
146
it ( "run-p command" , ( ) =>
173
147
runPar ( [ "test-task:dump {1} {2} {3} {@} {*}" , "--" , "1st" , "2nd" ] )
174
- . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) )
175
- )
148
+ . then ( ( ) => assert ( result ( ) === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]" ) ) )
176
149
} )
177
150
178
151
describe ( "'{1:-foo}' should be replaced by 'foo' if arguments are nothing:" , ( ) => {
179
152
it ( "Node API" , ( ) =>
180
153
nodeApi ( "test-task:dump {1:-foo} {1}" )
181
- . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) )
182
- )
154
+ . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) ) )
183
155
184
156
it ( "npm-run-all command" , ( ) =>
185
157
runAll ( [ "test-task:dump {1:-foo} {1}" ] )
186
- . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) )
187
- )
158
+ . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) ) )
188
159
189
160
it ( "run-s command" , ( ) =>
190
161
runSeq ( [ "test-task:dump {1:-foo} {1}" ] )
191
- . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) )
192
- )
162
+ . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) ) )
193
163
194
164
it ( "run-p command" , ( ) =>
195
165
runPar ( [ "test-task:dump {1:-foo} {1}" ] )
196
- . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) )
197
- )
166
+ . then ( ( ) => assert ( result ( ) === "[\"foo\"]" ) ) )
198
167
} )
199
168
200
169
describe ( "'{1:=foo}' should be replaced by 'foo' and should affect following '{1}' if arguments are nothing:" , ( ) => {
201
170
it ( "Node API" , ( ) =>
202
171
nodeApi ( "test-task:dump {1:=foo} {1}" )
203
- . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) )
204
- )
172
+ . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) ) )
205
173
206
174
it ( "npm-run-all command" , ( ) =>
207
175
runAll ( [ "test-task:dump {1:=foo} {1}" ] )
208
- . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) )
209
- )
176
+ . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) ) )
210
177
211
178
it ( "run-s command" , ( ) =>
212
179
runSeq ( [ "test-task:dump {1:=foo} {1}" ] )
213
- . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) )
214
- )
180
+ . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) ) )
215
181
216
182
it ( "run-p command" , ( ) =>
217
183
runPar ( [ "test-task:dump {1:=foo} {1}" ] )
218
- . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) )
219
- )
184
+ . then ( ( ) => assert ( result ( ) === "[\"foo\",\"foo\"]" ) ) )
220
185
} )
221
186
} )
0 commit comments