Skip to content

Commit b0f2415

Browse files
aduh95danielleadams
authored andcommitted
test: add trailing commas in test/js-native-api
PR-URL: #46385 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 8dfa748 commit b0f2415

File tree

12 files changed

+43
-44
lines changed

12 files changed

+43
-44
lines changed

test/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ overrides:
7474
- files:
7575
- es-module/*.js
7676
- es-module/*.mjs
77-
- js-native-api/*/*.js
7877
- parallel/*.js
7978
- parallel/*.mjs
8079
- pummel/*.js

test/js-native-api/test_array/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ assert.throws(
2323
() => {
2424
test_array.TestGetElement(array, array.length + 1);
2525
},
26-
/^Error: assertion \(\(\(uint32_t\)index < length\)\) failed: Index out of bounds!$/
26+
/^Error: assertion \(\(\(uint32_t\)index < length\)\) failed: Index out of bounds!$/,
2727
);
2828

2929
assert.throws(
3030
() => {
3131
test_array.TestGetElement(array, -2);
3232
},
33-
/^Error: assertion \(index >= 0\) failed: Invalid index\. Expects a positive integer\.$/
33+
/^Error: assertion \(index >= 0\) failed: Invalid index\. Expects a positive integer\.$/,
3434
);
3535

3636
array.forEach(function(element, index) {

test/js-native-api/test_bigint/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ assert.throws(() => CreateTooBigBigInt(), {
4848
// Test that we correctly forward exceptions from the engine.
4949
assert.throws(() => MakeBigIntWordsThrow(), {
5050
name: 'RangeError',
51-
message: 'Maximum BigInt size exceeded'
51+
message: 'Maximum BigInt size exceeded',
5252
});

test/js-native-api/test_constructor/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ assert.deepStrictEqual(TestConstructor.TestDefineClass(), {
5858
cbIsNull: 'Invalid argument',
5959
cbDataIsNull: 'napi_ok',
6060
propertiesIsNull: 'Invalid argument',
61-
resultIsNull: 'Invalid argument'
61+
resultIsNull: 'Invalid argument',
6262
});

test/js-native-api/test_conversions/test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -143,76 +143,76 @@ assert.deepStrictEqual(test.testNull.getValueBool(), {
143143
envIsNull: 'Invalid argument',
144144
valueIsNull: 'Invalid argument',
145145
resultIsNull: 'Invalid argument',
146-
inputTypeCheck: 'A boolean was expected'
146+
inputTypeCheck: 'A boolean was expected',
147147
});
148148

149149
assert.deepStrictEqual(test.testNull.getValueInt32(), {
150150
envIsNull: 'Invalid argument',
151151
valueIsNull: 'Invalid argument',
152152
resultIsNull: 'Invalid argument',
153-
inputTypeCheck: 'A number was expected'
153+
inputTypeCheck: 'A number was expected',
154154
});
155155

156156
assert.deepStrictEqual(test.testNull.getValueUint32(), {
157157
envIsNull: 'Invalid argument',
158158
valueIsNull: 'Invalid argument',
159159
resultIsNull: 'Invalid argument',
160-
inputTypeCheck: 'A number was expected'
160+
inputTypeCheck: 'A number was expected',
161161
});
162162

163163
assert.deepStrictEqual(test.testNull.getValueInt64(), {
164164
envIsNull: 'Invalid argument',
165165
valueIsNull: 'Invalid argument',
166166
resultIsNull: 'Invalid argument',
167-
inputTypeCheck: 'A number was expected'
167+
inputTypeCheck: 'A number was expected',
168168
});
169169

170170

171171
assert.deepStrictEqual(test.testNull.getValueDouble(), {
172172
envIsNull: 'Invalid argument',
173173
valueIsNull: 'Invalid argument',
174174
resultIsNull: 'Invalid argument',
175-
inputTypeCheck: 'A number was expected'
175+
inputTypeCheck: 'A number was expected',
176176
});
177177

178178
assert.deepStrictEqual(test.testNull.coerceToBool(), {
179179
envIsNull: 'Invalid argument',
180180
valueIsNull: 'Invalid argument',
181181
resultIsNull: 'Invalid argument',
182-
inputTypeCheck: 'napi_ok'
182+
inputTypeCheck: 'napi_ok',
183183
});
184184

185185
assert.deepStrictEqual(test.testNull.coerceToObject(), {
186186
envIsNull: 'Invalid argument',
187187
valueIsNull: 'Invalid argument',
188188
resultIsNull: 'Invalid argument',
189-
inputTypeCheck: 'napi_ok'
189+
inputTypeCheck: 'napi_ok',
190190
});
191191

192192
assert.deepStrictEqual(test.testNull.coerceToString(), {
193193
envIsNull: 'Invalid argument',
194194
valueIsNull: 'Invalid argument',
195195
resultIsNull: 'Invalid argument',
196-
inputTypeCheck: 'napi_ok'
196+
inputTypeCheck: 'napi_ok',
197197
});
198198

199199
assert.deepStrictEqual(test.testNull.getValueStringUtf8(), {
200200
envIsNull: 'Invalid argument',
201201
valueIsNull: 'Invalid argument',
202202
wrongTypeIn: 'A string was expected',
203-
bufAndOutLengthIsNull: 'Invalid argument'
203+
bufAndOutLengthIsNull: 'Invalid argument',
204204
});
205205

206206
assert.deepStrictEqual(test.testNull.getValueStringLatin1(), {
207207
envIsNull: 'Invalid argument',
208208
valueIsNull: 'Invalid argument',
209209
wrongTypeIn: 'A string was expected',
210-
bufAndOutLengthIsNull: 'Invalid argument'
210+
bufAndOutLengthIsNull: 'Invalid argument',
211211
});
212212

213213
assert.deepStrictEqual(test.testNull.getValueStringUtf16(), {
214214
envIsNull: 'Invalid argument',
215215
valueIsNull: 'Invalid argument',
216216
wrongTypeIn: 'A string was expected',
217-
bufAndOutLengthIsNull: 'Invalid argument'
217+
bufAndOutLengthIsNull: 'Invalid argument',
218218
});

test/js-native-api/test_error/test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,35 @@ assert.throws(() => {
7070
(err) => {
7171
assert.strictEqual(err, value);
7272
return true;
73-
}
73+
},
7474
));
7575

7676
assert.throws(
7777
() => test_error.throwErrorCode(),
7878
{
7979
code: 'ERR_TEST_CODE',
80-
message: 'Error [error]'
80+
message: 'Error [error]',
8181
});
8282

8383
assert.throws(
8484
() => test_error.throwRangeErrorCode(),
8585
{
8686
code: 'ERR_TEST_CODE',
87-
message: 'RangeError [range error]'
87+
message: 'RangeError [range error]',
8888
});
8989

9090
assert.throws(
9191
() => test_error.throwTypeErrorCode(),
9292
{
9393
code: 'ERR_TEST_CODE',
94-
message: 'TypeError [type error]'
94+
message: 'TypeError [type error]',
9595
});
9696

9797
assert.throws(
9898
() => test_error.throwSyntaxErrorCode(),
9999
{
100100
code: 'ERR_TEST_CODE',
101-
message: 'SyntaxError [syntax error]'
101+
message: 'SyntaxError [syntax error]',
102102
});
103103

104104
let error = test_error.createError();

test/js-native-api/test_exception/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const test_exception = (function() {
3131
// Test that the native side passes the exception through
3232
assert.throws(
3333
() => { test_exception.allowException(throwTheError); },
34-
(err) => err === theError
34+
(err) => err === theError,
3535
);
3636

3737
// Test that the exception thrown above was marked as pending
@@ -59,7 +59,7 @@ const test_exception = (function() {
5959
// Test that the native side passes the exception through
6060
assert.throws(
6161
() => { test_exception.constructAllowException(throwTheError); },
62-
(err) => err === theError
62+
(err) => err === theError,
6363
);
6464

6565
// Test that the exception thrown above was marked as pending

test/js-native-api/test_function/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ assert.deepStrictEqual(test_function.TestCreateFunctionParameters(), {
4040
envIsNull: 'Invalid argument',
4141
nameIsNull: 'napi_ok',
4242
cbIsNull: 'Invalid argument',
43-
resultIsNull: 'Invalid argument'
43+
resultIsNull: 'Invalid argument',
4444
});
4545

4646
assert.throws(
4747
() => test_function.TestBadReturnExceptionPending(),
4848
{
4949
code: 'throwing exception',
50-
name: 'Error'
51-
}
50+
name: 'Error',
51+
},
5252
);

test/js-native-api/test_general/testEnvCleanup.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (process.argv[2] === 'child') {
1111
'simple wrap': 0,
1212
'wrap, removeWrap': 1,
1313
'first wrap': 2,
14-
'second wrap': 3
14+
'second wrap': 3,
1515
};
1616

1717
// We attach the three objects we will test to `module.exports` to ensure they
@@ -39,7 +39,7 @@ if (process.argv[2] === 'child') {
3939
const { spawnSync } = require('child_process');
4040

4141
const child = spawnSync(process.execPath, [__filename, 'child'], {
42-
stdio: [ process.stdin, 'pipe', process.stderr ]
42+
stdio: [ process.stdin, 'pipe', process.stderr ],
4343
});
4444

4545
// Grab the child's output and construct an object whose keys are the rows of
@@ -49,7 +49,7 @@ if (process.argv[2] === 'child') {
4949
child.stdout.toString().split(/\r\n|\r|\n/g).reduce((obj, item) =>
5050
Object.assign(obj, item ? { [item]: true } : {}), {}), {
5151
'finalize at env cleanup for simple wrap': true,
52-
'finalize at env cleanup for second wrap': true
52+
'finalize at env cleanup for second wrap': true,
5353
});
5454

5555
// Ensure that the child exited successfully.

test/js-native-api/test_general/testInstanceOf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ if (typeof Symbol !== 'undefined' && 'hasInstance' in Symbol &&
6161
function compareToNative(theObject, theConstructor) {
6262
assert.strictEqual(
6363
addon.doInstanceOf(theObject, theConstructor),
64-
(theObject instanceof theConstructor)
64+
(theObject instanceof theConstructor),
6565
);
6666
}
6767

6868
function MyClass() {}
6969
Object.defineProperty(MyClass, Symbol.hasInstance, {
7070
value: function(candidate) {
7171
return 'mark' in candidate;
72-
}
72+
},
7373
});
7474

7575
function MySubClass() {}

test/js-native-api/test_object/test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const object = {
1212
1, 94, 'str', 12.321, { test: 'obj in arr' },
1313
],
1414
newObject: {
15-
test: 'obj in obj'
16-
}
15+
test: 'obj in obj',
16+
},
1717
};
1818

1919
assert.strictEqual(test_object.Get(object, 'hello'), 'world');
@@ -91,7 +91,7 @@ assert.strictEqual(newObject.test_string, 'test string');
9191
const cube = {
9292
x: 10,
9393
y: 10,
94-
z: 10
94+
z: 10,
9595
};
9696

9797
assert.deepStrictEqual(test_object.Inflate(cube), { x: 11, y: 11, z: 11 });
@@ -107,7 +107,7 @@ assert.strictEqual(newObject.test_string, 'test string');
107107
const sym4 = Symbol('4');
108108
const object2 = {
109109
[sym1]: '@@iterator',
110-
[sym2]: sym3
110+
[sym2]: sym3,
111111
};
112112

113113
assert(test_object.Has(object2, sym1));
@@ -236,7 +236,7 @@ assert.strictEqual(newObject.test_string, 'test string');
236236
// and includes indices and converts them to strings.
237237

238238
const object = Object.create({
239-
inherited: 1
239+
inherited: 1,
240240
});
241241

242242
const fooSymbol = Symbol('foo');
@@ -247,19 +247,19 @@ assert.strictEqual(newObject.test_string, 'test string');
247247
value: 4,
248248
enumerable: false,
249249
writable: true,
250-
configurable: true
250+
configurable: true,
251251
});
252252
Object.defineProperty(object, 'writable', {
253253
value: 4,
254254
enumerable: true,
255255
writable: true,
256-
configurable: false
256+
configurable: false,
257257
});
258258
Object.defineProperty(object, 'configurable', {
259259
value: 4,
260260
enumerable: true,
261261
writable: false,
262-
configurable: true
262+
configurable: true,
263263
});
264264
object[5] = 5;
265265

@@ -308,7 +308,7 @@ assert.deepStrictEqual(test_object.TestSetProperty(), {
308308
envIsNull: 'Invalid argument',
309309
objectIsNull: 'Invalid argument',
310310
keyIsNull: 'Invalid argument',
311-
valueIsNull: 'Invalid argument'
311+
valueIsNull: 'Invalid argument',
312312
});
313313

314314
// Verify that passing NULL to napi_has_property() results in the correct
@@ -317,7 +317,7 @@ assert.deepStrictEqual(test_object.TestHasProperty(), {
317317
envIsNull: 'Invalid argument',
318318
objectIsNull: 'Invalid argument',
319319
keyIsNull: 'Invalid argument',
320-
resultIsNull: 'Invalid argument'
320+
resultIsNull: 'Invalid argument',
321321
});
322322

323323
// Verify that passing NULL to napi_get_property() results in the correct
@@ -326,7 +326,7 @@ assert.deepStrictEqual(test_object.TestGetProperty(), {
326326
envIsNull: 'Invalid argument',
327327
objectIsNull: 'Invalid argument',
328328
keyIsNull: 'Invalid argument',
329-
resultIsNull: 'Invalid argument'
329+
resultIsNull: 'Invalid argument',
330330
});
331331

332332
{

test/js-native-api/test_object/test_null.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const expectedForProperty = {
99
envIsNull: 'Invalid argument',
1010
objectIsNull: 'Invalid argument',
1111
keyIsNull: 'Invalid argument',
12-
valueIsNull: 'Invalid argument'
12+
valueIsNull: 'Invalid argument',
1313
};
1414
assert.deepStrictEqual(testNull.setProperty(), expectedForProperty);
1515
assert.deepStrictEqual(testNull.getProperty(), expectedForProperty);
@@ -28,7 +28,7 @@ assert.deepStrictEqual(testNull.hasNamedProperty(), expectedForProperty);
2828
const expectedForElement = {
2929
envIsNull: 'Invalid argument',
3030
objectIsNull: 'Invalid argument',
31-
valueIsNull: 'Invalid argument'
31+
valueIsNull: 'Invalid argument',
3232
};
3333
assert.deepStrictEqual(testNull.setElement(), expectedForElement);
3434
assert.deepStrictEqual(testNull.getElement(), expectedForElement);

0 commit comments

Comments
 (0)