mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test: add trailing commas in test/node-api
PR-URL: https://github.com/nodejs/node/pull/46384 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
ac66a99cf1
commit
d640feee85
|
|
@ -79,7 +79,6 @@ overrides:
|
||||||
- internet/*.js
|
- internet/*.js
|
||||||
- js-native-api/*/*.js
|
- js-native-api/*/*.js
|
||||||
- known_issues/*.js
|
- known_issues/*.js
|
||||||
- node-api/*/*.js
|
|
||||||
- parallel/*.js
|
- parallel/*.js
|
||||||
- parallel/*.mjs
|
- parallel/*.mjs
|
||||||
- pummel/*.js
|
- pummel/*.js
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ async_hooks.createHook({
|
||||||
if (testId === id) {
|
if (testId === id) {
|
||||||
events.push({ type: 'destroy', id });
|
events.push({ type: 'destroy', id });
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}).enable();
|
}).enable();
|
||||||
|
|
||||||
const resource = { foo: 'foo' };
|
const resource = { foo: 'foo' };
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ const test_hook = async_hooks.createHook({
|
||||||
test_hook.enable();
|
test_hook.enable();
|
||||||
const asyncResource = createAsyncResource(
|
const asyncResource = createAsyncResource(
|
||||||
{ foo: 'bar' },
|
{ foo: 'bar' },
|
||||||
/* destroy_on_finalizer */false
|
/* destroy_on_finalizer */false,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Trigger GC. This does *not* use global.gc(), because what we want to verify
|
// Trigger GC. This does *not* use global.gc(), because what we want to verify
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const resourceWrap = createAsyncResource(
|
||||||
/**
|
/**
|
||||||
* set resource to NULL to generate a managed resource object
|
* set resource to NULL to generate a managed resource object
|
||||||
*/
|
*/
|
||||||
undefined
|
undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(hook_result.destroy_called, false);
|
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.destroy_called, false);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
hook_result.resource,
|
hook_result.resource,
|
||||||
async_hooks.executionAsyncResource()
|
async_hooks.executionAsyncResource(),
|
||||||
);
|
);
|
||||||
assert.strictEqual(this, recv);
|
assert.strictEqual(this, recv);
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ makeCallback(resourceWrap, recv, function callback() {
|
||||||
assert.strictEqual(hook_result.destroy_called, false);
|
assert.strictEqual(hook_result.destroy_called, false);
|
||||||
assert.notStrictEqual(
|
assert.notStrictEqual(
|
||||||
hook_result.resource,
|
hook_result.resource,
|
||||||
async_hooks.executionAsyncResource()
|
async_hooks.executionAsyncResource(),
|
||||||
);
|
);
|
||||||
|
|
||||||
destroyAsyncResource(resourceWrap);
|
destroyAsyncResource(resourceWrap);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ async_hooks.createHook({
|
||||||
after: common.mustCall((id) => {
|
after: common.mustCall((id) => {
|
||||||
assert.strictEqual(id, expectedId);
|
assert.strictEqual(id, expectedId);
|
||||||
insideHook = false;
|
insideHook = false;
|
||||||
})
|
}),
|
||||||
}).enable();
|
}).enable();
|
||||||
|
|
||||||
runInCallbackScope(expectedResource, expectedResourceType, () => {
|
runInCallbackScope(expectedResource, expectedResourceType, () => {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ tmpdir.refresh();
|
||||||
fs.rmSync(urlTestDir, {
|
fs.rmSync(urlTestDir, {
|
||||||
force: true,
|
force: true,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
maxRetries: 256
|
maxRetries: 256,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ function test(shouldFail, resources) {
|
||||||
|
|
||||||
test(false, [{
|
test(false, [{
|
||||||
url: depURL,
|
url: depURL,
|
||||||
integrity: `sha256-${hash('sha256', depBody)}`
|
integrity: `sha256-${hash('sha256', depBody)}`,
|
||||||
}]);
|
}]);
|
||||||
test(true, [{
|
test(true, [{
|
||||||
url: depURL,
|
url: depURL,
|
||||||
integrity: `sha256akjsalkjdlaskjdk-${hash('sha256', depBody)}`
|
integrity: `sha256akjsalkjdlaskjdk-${hash('sha256', depBody)}`,
|
||||||
}]);
|
}]);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ function testUnref(queueSize) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let output = '';
|
let output = '';
|
||||||
const child = fork(__filename, ['child', queueSize], {
|
const child = fork(__filename, ['child', queueSize], {
|
||||||
stdio: [process.stdin, 'pipe', process.stderr, 'ipc']
|
stdio: [process.stdin, 'pipe', process.stderr, 'ipc'],
|
||||||
});
|
});
|
||||||
child.on('close', (code) => {
|
child.on('close', (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
|
@ -99,7 +99,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
quitAfter: binding.ARRAY_LENGTH
|
quitAfter: binding.ARRAY_LENGTH,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThreadNoJsFunc',
|
threadStarter: 'StartThreadNoJsFunc',
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
quitAfter: binding.ARRAY_LENGTH
|
quitAfter: binding.ARRAY_LENGTH,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
maxQueueSize: 0,
|
maxQueueSize: 0,
|
||||||
quitAfter: binding.ARRAY_LENGTH
|
quitAfter: binding.ARRAY_LENGTH,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThreadNonblocking',
|
threadStarter: 'StartThreadNonblocking',
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
quitAfter: binding.ARRAY_LENGTH
|
quitAfter: binding.ARRAY_LENGTH,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
quitAfter: 1
|
quitAfter: 1,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
maxQueueSize: 0,
|
maxQueueSize: 0,
|
||||||
quitAfter: 1
|
quitAfter: 1,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThreadNonblocking',
|
threadStarter: 'StartThreadNonblocking',
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
quitAfter: 1
|
quitAfter: 1,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
quitAfter: 1,
|
quitAfter: 1,
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
launchSecondary: true
|
launchSecondary: true,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
threadStarter: 'StartThreadNonblocking',
|
threadStarter: 'StartThreadNonblocking',
|
||||||
quitAfter: 1,
|
quitAfter: 1,
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
launchSecondary: true
|
launchSecondary: true,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
quitAfter: 1,
|
quitAfter: 1,
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
abort: true
|
abort: true,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
threadStarter: 'StartThread',
|
threadStarter: 'StartThread',
|
||||||
quitAfter: 1,
|
quitAfter: 1,
|
||||||
maxQueueSize: 0,
|
maxQueueSize: 0,
|
||||||
abort: true
|
abort: true,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
threadStarter: 'StartThreadNonblocking',
|
threadStarter: 'StartThreadNonblocking',
|
||||||
quitAfter: 1,
|
quitAfter: 1,
|
||||||
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
maxQueueSize: binding.MAX_QUEUE_SIZE,
|
||||||
abort: true
|
abort: true,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
.then((result) => assert.strictEqual(result.indexOf(0), -1))
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ new Promise(function testWithoutJSMarshaller(resolve) {
|
||||||
.then(() => testWithJSMarshaller({
|
.then(() => testWithJSMarshaller({
|
||||||
threadStarter: 'StartThreadNonblocking',
|
threadStarter: 'StartThreadNonblocking',
|
||||||
maxQueueSize: binding.ARRAY_LENGTH >>> 1,
|
maxQueueSize: binding.ARRAY_LENGTH >>> 1,
|
||||||
quitAfter: binding.ARRAY_LENGTH
|
quitAfter: binding.ARRAY_LENGTH,
|
||||||
}))
|
}))
|
||||||
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
.then((result) => assert.deepStrictEqual(result, expectedArray))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const binding = require(`./build/${common.buildType}/binding`);
|
||||||
process.on(
|
process.on(
|
||||||
'uncaughtException',
|
'uncaughtException',
|
||||||
common.mustNotCall('uncaught callback errors should be suppressed ' +
|
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(
|
binding.CallIntoModule(
|
||||||
|
|
@ -18,5 +18,5 @@ binding.CallIntoModule(
|
||||||
'resource_name',
|
'resource_name',
|
||||||
common.mustCall(function finalizer() {
|
common.mustCall(function finalizer() {
|
||||||
throw new Error('finalizer error');
|
throw new Error('finalizer error');
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ binding.CallIntoModule(
|
||||||
'resource_name',
|
'resource_name',
|
||||||
common.mustCall(function finalizer() {
|
common.mustCall(function finalizer() {
|
||||||
throw new Error('finalizer error');
|
throw new Error('finalizer error');
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user