From d640feee85447b16af13dcd5ddaa26ede4eec826 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 25 Jan 2023 07:05:53 +0100 Subject: [PATCH] test: add trailing commas in `test/node-api` PR-URL: https://github.com/nodejs/node/pull/46384 Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- test/.eslintrc.yaml | 1 - test/node-api/test_async/test-async-hooks.js | 2 +- .../test-gcable-callback.js | 2 +- test/node-api/test_async_context/test.js | 6 ++-- .../test_callback_scope/test-async-hooks.js | 2 +- test/node-api/test_general/test.js | 2 +- test/node-api/test_policy/test_policy.js | 4 +-- .../node-api/test_threadsafe_function/test.js | 28 +++++++++---------- .../test_force_uncaught_exception.js | 4 +-- .../test_uncaught_exception.js | 2 +- 10 files changed, 26 insertions(+), 27 deletions(-) diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 7be4848551c01c..83bb69c87b1ac6 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -79,7 +79,6 @@ overrides: - internet/*.js - js-native-api/*/*.js - known_issues/*.js - - node-api/*/*.js - parallel/*.js - parallel/*.mjs - pummel/*.js diff --git a/test/node-api/test_async/test-async-hooks.js b/test/node-api/test_async/test-async-hooks.js index e7879c5ad2b686..956d210f3f0832 100644 --- a/test/node-api/test_async/test-async-hooks.js +++ b/test/node-api/test_async/test-async-hooks.js @@ -29,7 +29,7 @@ async_hooks.createHook({ if (testId === id) { events.push({ type: 'destroy', id }); } - } + }, }).enable(); const resource = { foo: 'foo' }; diff --git a/test/node-api/test_async_context/test-gcable-callback.js b/test/node-api/test_async_context/test-gcable-callback.js index e66080bb6a3a90..e1283d1ca4ea79 100644 --- a/test/node-api/test_async_context/test-gcable-callback.js +++ b/test/node-api/test_async_context/test-gcable-callback.js @@ -34,7 +34,7 @@ const test_hook = async_hooks.createHook({ test_hook.enable(); const asyncResource = createAsyncResource( { foo: 'bar' }, - /* destroy_on_finalizer */false + /* destroy_on_finalizer */false, ); // Trigger GC. This does *not* use global.gc(), because what we want to verify diff --git a/test/node-api/test_async_context/test.js b/test/node-api/test_async_context/test.js index 2cf00b1ef7bb0e..9dae6345137f0a 100644 --- a/test/node-api/test_async_context/test.js +++ b/test/node-api/test_async_context/test.js @@ -35,7 +35,7 @@ const resourceWrap = createAsyncResource( /** * set resource to NULL to generate a managed resource object */ - undefined + undefined, ); assert.strictEqual(hook_result.destroy_called, false); @@ -44,7 +44,7 @@ makeCallback(resourceWrap, recv, function callback() { assert.strictEqual(hook_result.destroy_called, false); assert.strictEqual( hook_result.resource, - async_hooks.executionAsyncResource() + async_hooks.executionAsyncResource(), ); assert.strictEqual(this, recv); @@ -52,7 +52,7 @@ makeCallback(resourceWrap, recv, function callback() { assert.strictEqual(hook_result.destroy_called, false); assert.notStrictEqual( hook_result.resource, - async_hooks.executionAsyncResource() + async_hooks.executionAsyncResource(), ); destroyAsyncResource(resourceWrap); diff --git a/test/node-api/test_callback_scope/test-async-hooks.js b/test/node-api/test_callback_scope/test-async-hooks.js index 22074428883d6b..2ae8da5ea2f31f 100644 --- a/test/node-api/test_callback_scope/test-async-hooks.js +++ b/test/node-api/test_callback_scope/test-async-hooks.js @@ -31,7 +31,7 @@ async_hooks.createHook({ after: common.mustCall((id) => { assert.strictEqual(id, expectedId); insideHook = false; - }) + }), }).enable(); runInCallbackScope(expectedResource, expectedResourceType, () => { diff --git a/test/node-api/test_general/test.js b/test/node-api/test_general/test.js index f51ef2367f5b90..397bb3c91f629b 100644 --- a/test/node-api/test_general/test.js +++ b/test/node-api/test_general/test.js @@ -34,7 +34,7 @@ tmpdir.refresh(); fs.rmSync(urlTestDir, { force: true, recursive: true, - maxRetries: 256 + maxRetries: 256, }); } diff --git a/test/node-api/test_policy/test_policy.js b/test/node-api/test_policy/test_policy.js index b69dbded585891..d6cb12b56cb683 100644 --- a/test/node-api/test_policy/test_policy.js +++ b/test/node-api/test_policy/test_policy.js @@ -57,9 +57,9 @@ function test(shouldFail, resources) { test(false, [{ url: depURL, - integrity: `sha256-${hash('sha256', depBody)}` + integrity: `sha256-${hash('sha256', depBody)}`, }]); test(true, [{ url: depURL, - integrity: `sha256akjsalkjdlaskjdk-${hash('sha256', depBody)}` + integrity: `sha256akjsalkjdlaskjdk-${hash('sha256', depBody)}`, }]); diff --git a/test/node-api/test_threadsafe_function/test.js b/test/node-api/test_threadsafe_function/test.js index ff8a7d80849079..8cb033419bf41a 100644 --- a/test/node-api/test_threadsafe_function/test.js +++ b/test/node-api/test_threadsafe_function/test.js @@ -63,7 +63,7 @@ function testUnref(queueSize) { return new Promise((resolve, reject) => { let output = ''; const child = fork(__filename, ['child', queueSize], { - stdio: [process.stdin, 'pipe', process.stderr, 'ipc'] + stdio: [process.stdin, 'pipe', process.stderr, 'ipc'], }); child.on('close', (code) => { if (code === 0) { @@ -99,7 +99,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThread', maxQueueSize: binding.MAX_QUEUE_SIZE, - quitAfter: binding.ARRAY_LENGTH + quitAfter: binding.ARRAY_LENGTH, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -110,7 +110,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThreadNoJsFunc', maxQueueSize: binding.MAX_QUEUE_SIZE, - quitAfter: binding.ARRAY_LENGTH + quitAfter: binding.ARRAY_LENGTH, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -119,7 +119,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThread', maxQueueSize: 0, - quitAfter: binding.ARRAY_LENGTH + quitAfter: binding.ARRAY_LENGTH, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -128,7 +128,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThreadNonblocking', maxQueueSize: binding.MAX_QUEUE_SIZE, - quitAfter: binding.ARRAY_LENGTH + quitAfter: binding.ARRAY_LENGTH, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -137,7 +137,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThread', maxQueueSize: binding.MAX_QUEUE_SIZE, - quitAfter: 1 + quitAfter: 1, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -146,7 +146,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThread', maxQueueSize: 0, - quitAfter: 1 + quitAfter: 1, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -155,7 +155,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThreadNonblocking', maxQueueSize: binding.MAX_QUEUE_SIZE, - quitAfter: 1 + quitAfter: 1, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -166,7 +166,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { threadStarter: 'StartThread', quitAfter: 1, maxQueueSize: binding.MAX_QUEUE_SIZE, - launchSecondary: true + launchSecondary: true, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -177,7 +177,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { threadStarter: 'StartThreadNonblocking', quitAfter: 1, maxQueueSize: binding.MAX_QUEUE_SIZE, - launchSecondary: true + launchSecondary: true, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) @@ -187,7 +187,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { threadStarter: 'StartThread', quitAfter: 1, maxQueueSize: binding.MAX_QUEUE_SIZE, - abort: true + abort: true, })) .then((result) => assert.strictEqual(result.indexOf(0), -1)) @@ -197,7 +197,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { threadStarter: 'StartThread', quitAfter: 1, maxQueueSize: 0, - abort: true + abort: true, })) .then((result) => assert.strictEqual(result.indexOf(0), -1)) @@ -207,7 +207,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { threadStarter: 'StartThreadNonblocking', quitAfter: 1, maxQueueSize: binding.MAX_QUEUE_SIZE, - abort: true + abort: true, })) .then((result) => assert.strictEqual(result.indexOf(0), -1)) @@ -216,7 +216,7 @@ new Promise(function testWithoutJSMarshaller(resolve) { .then(() => testWithJSMarshaller({ threadStarter: 'StartThreadNonblocking', maxQueueSize: binding.ARRAY_LENGTH >>> 1, - quitAfter: binding.ARRAY_LENGTH + quitAfter: binding.ARRAY_LENGTH, })) .then((result) => assert.deepStrictEqual(result, expectedArray)) diff --git a/test/node-api/test_threadsafe_function/test_force_uncaught_exception.js b/test/node-api/test_threadsafe_function/test_force_uncaught_exception.js index c23ad44ae88862..b1f95715eadf60 100644 --- a/test/node-api/test_threadsafe_function/test_force_uncaught_exception.js +++ b/test/node-api/test_threadsafe_function/test_force_uncaught_exception.js @@ -7,7 +7,7 @@ const binding = require(`./build/${common.buildType}/binding`); process.on( 'uncaughtException', common.mustNotCall('uncaught callback errors should be suppressed ' + - 'with the option --no-force-node-api-uncaught-exceptions-policy') + 'with the option --no-force-node-api-uncaught-exceptions-policy'), ); binding.CallIntoModule( @@ -18,5 +18,5 @@ binding.CallIntoModule( 'resource_name', common.mustCall(function finalizer() { throw new Error('finalizer error'); - }) + }), ); diff --git a/test/node-api/test_threadsafe_function/test_uncaught_exception.js b/test/node-api/test_threadsafe_function/test_uncaught_exception.js index 45e7370c33ea65..2529757908999b 100644 --- a/test/node-api/test_threadsafe_function/test_uncaught_exception.js +++ b/test/node-api/test_threadsafe_function/test_uncaught_exception.js @@ -23,5 +23,5 @@ binding.CallIntoModule( 'resource_name', common.mustCall(function finalizer() { throw new Error('finalizer error'); - }) + }), );