Skip to content

Commit

Permalink
test: add trailing commas in test/node-api
Browse files Browse the repository at this point in the history
PR-URL: #46384
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and juanarbol committed Mar 5, 2023
1 parent f2ebe66 commit f2bba1b
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 27 deletions.
1 change: 0 additions & 1 deletion test/.eslintrc.yaml
Expand Up @@ -77,7 +77,6 @@ overrides:
- internet/*.js
- js-native-api/*/*.js
- known_issues/*.js
- node-api/*/*.js
- parallel/*.js
- parallel/*.mjs
- pummel/*.js
Expand Down
2 changes: 1 addition & 1 deletion test/node-api/test_async/test-async-hooks.js
Expand Up @@ -29,7 +29,7 @@ async_hooks.createHook({
if (testId === id) {
events.push({ type: 'destroy', id });
}
}
},
}).enable();

const resource = { foo: 'foo' };
Expand Down
2 changes: 1 addition & 1 deletion test/node-api/test_async_context/test-gcable-callback.js
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/node-api/test_async_context/test.js
Expand Up @@ -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);
Expand All @@ -44,15 +44,15 @@ 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);

setImmediate(() => {
assert.strictEqual(hook_result.destroy_called, false);
assert.notStrictEqual(
hook_result.resource,
async_hooks.executionAsyncResource()
async_hooks.executionAsyncResource(),
);

destroyAsyncResource(resourceWrap);
Expand Down
2 changes: 1 addition & 1 deletion test/node-api/test_callback_scope/test-async-hooks.js
Expand Up @@ -31,7 +31,7 @@ async_hooks.createHook({
after: common.mustCall((id) => {
assert.strictEqual(id, expectedId);
insideHook = false;
})
}),
}).enable();

runInCallbackScope(expectedResource, expectedResourceType, () => {
Expand Down
2 changes: 1 addition & 1 deletion test/node-api/test_general/test.js
Expand Up @@ -34,7 +34,7 @@ tmpdir.refresh();
fs.rmSync(urlTestDir, {
force: true,
recursive: true,
maxRetries: 256
maxRetries: 256,
});
}

Expand Down
4 changes: 2 additions & 2 deletions test/node-api/test_policy/test_policy.js
Expand Up @@ -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)}`,
}]);
28 changes: 14 additions & 14 deletions test/node-api/test_threadsafe_function/test.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand All @@ -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))

Expand Down
Expand Up @@ -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(
Expand All @@ -18,5 +18,5 @@ binding.CallIntoModule(
'resource_name',
common.mustCall(function finalizer() {
throw new Error('finalizer error');
})
}),
);
Expand Up @@ -23,5 +23,5 @@ binding.CallIntoModule(
'resource_name',
common.mustCall(function finalizer() {
throw new Error('finalizer error');
})
}),
);

0 comments on commit f2bba1b

Please sign in to comment.