Skip to content

Commit 8232d36

Browse files
author
Benjamin E. Coe
authored
formatting: node linter expects Error objects (#102)
1 parent f922a51 commit 8232d36

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

test/index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ test('when short option listed in short used as flag then long option stored as
4848
t.end();
4949
});
5050

51-
test('when short option listed in short and long listed in `type: "string"` and used with value then long option stored as value', (t) => {
51+
test('when short option listed in short and long listed in `type: "string"` and ' +
52+
'used with value then long option stored as value', (t) => {
5253
const passedArgs = ['-f', 'bar'];
5354
const passedOptions = { foo: { short: 'f', type: 'string' } };
5455
const expected = { values: { foo: 'bar' }, positionals: [] };
@@ -127,7 +128,7 @@ test('Everything after a bare `--` is considered a positional argument', (t) =>
127128
const expected = { values: {}, positionals: ['barepositionals', 'mopositionals'] };
128129
const args = parseArgs({ args: passedArgs });
129130

130-
t.deepEqual(args, expected, 'testing bare positionals');
131+
t.deepEqual(args, expected, Error('testing bare positionals'));
131132

132133
t.end();
133134
});
@@ -137,7 +138,7 @@ test('args are true', (t) => {
137138
const expected = { values: { foo: true, bar: true }, positionals: [] };
138139
const args = parseArgs({ args: passedArgs });
139140

140-
t.deepEqual(args, expected, 'args are true');
141+
t.deepEqual(args, expected, Error('args are true'));
141142

142143
t.end();
143144
});
@@ -147,7 +148,7 @@ test('arg is true and positional is identified', (t) => {
147148
const expected = { values: { foo: true }, positionals: ['b'] };
148149
const args = parseArgs({ args: passedArgs });
149150

150-
t.deepEqual(args, expected, 'arg is true and positional is identified');
151+
t.deepEqual(args, expected, Error('arg is true and positional is identified'));
151152

152153
t.end();
153154
});
@@ -158,7 +159,7 @@ test('args equals are passed `type: "string"`', (t) => {
158159
const expected = { values: { so: 'wat' }, positionals: [] };
159160
const args = parseArgs({ args: passedArgs, options: passedOptions });
160161

161-
t.deepEqual(args, expected, 'arg value is passed');
162+
t.deepEqual(args, expected, Error('arg value is passed'));
162163

163164
t.end();
164165
});
@@ -179,7 +180,7 @@ test('zero config args equals are parsed as if `type: "string"`', (t) => {
179180
const expected = { values: { so: 'wat' }, positionals: [] };
180181
const args = parseArgs({ args: passedArgs, options: passedOptions });
181182

182-
t.deepEqual(args, expected, 'arg value is passed');
183+
t.deepEqual(args, expected, Error('arg value is passed'));
183184

184185
t.end();
185186
});
@@ -190,7 +191,7 @@ test('same arg is passed twice `type: "string"` and last value is recorded', (t)
190191
const expected = { values: { foo: 'b' }, positionals: [] };
191192
const args = parseArgs({ args: passedArgs, options: passedOptions });
192193

193-
t.deepEqual(args, expected, 'last arg value is passed');
194+
t.deepEqual(args, expected, Error('last arg value is passed'));
194195

195196
t.end();
196197
});
@@ -201,7 +202,7 @@ test('args equals pass string including more equals', (t) => {
201202
const expected = { values: { so: 'wat=bing' }, positionals: [] };
202203
const args = parseArgs({ args: passedArgs, options: passedOptions });
203204

204-
t.deepEqual(args, expected, 'arg value is passed');
205+
t.deepEqual(args, expected, Error('arg value is passed'));
205206

206207
t.end();
207208
});
@@ -212,7 +213,7 @@ test('first arg passed for `type: "string"` and "multiple" is in array', (t) =>
212213
const expected = { values: { foo: ['a'] }, positionals: [] };
213214
const args = parseArgs({ args: passedArgs, options: passedOptions });
214215

215-
t.deepEqual(args, expected, 'first multiple in array');
216+
t.deepEqual(args, expected, Error('first multiple in array'));
216217

217218
t.end();
218219
});
@@ -228,7 +229,7 @@ test('args are passed `type: "string"` and "multiple"', (t) => {
228229
const expected = { values: { foo: ['a', 'b'] }, positionals: [] };
229230
const args = parseArgs({ args: passedArgs, options: passedOptions });
230231

231-
t.deepEqual(args, expected, 'both arg values are passed');
232+
t.deepEqual(args, expected, Error('both arg values are passed'));
232233

233234
t.end();
234235
});
@@ -255,8 +256,8 @@ test('order of option and positional does not matter (per README)', (t) => {
255256
const passedOptions = { foo: { type: 'string' } };
256257
const expected = { values: { foo: 'bar' }, positionals: ['baz'] };
257258

258-
t.deepEqual(parseArgs({ args: passedArgs1, options: passedOptions }), expected, 'option then positional');
259-
t.deepEqual(parseArgs({ args: passedArgs2, options: passedOptions }), expected, 'positional then option');
259+
t.deepEqual(parseArgs({ args: passedArgs1, options: passedOptions }), expected, Error('option then positional'));
260+
t.deepEqual(parseArgs({ args: passedArgs2, options: passedOptions }), expected, Error('positional then option'));
260261

261262
t.end();
262263
});
@@ -351,7 +352,7 @@ test('excess leading dashes on options are retained', (t) => {
351352
};
352353
const result = parseArgs({ args: passedArgs, options: passedOptions });
353354

354-
t.deepEqual(result, expected, 'excess option dashes are retained');
355+
t.deepEqual(result, expected, Error('excess option dashes are retained'));
355356

356357
t.end();
357358
});

0 commit comments

Comments
 (0)