Skip to content

Commit 0f6e780

Browse files
committed
test: wrap suppressed callbacks with common.mustCall
1 parent 9468795 commit 0f6e780

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

test/parallel/test-diagnostics-channel-suppression.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const { AsyncLocalStorage } = require('async_hooks');
1212
const handler = common.mustNotCall();
1313
ch.subscribe(handler, { subscriberId: key });
1414

15-
suppressed(key, () => {
15+
suppressed(key, common.mustCall(() => {
1616
ch.publish({});
17-
});
17+
}));
1818

1919
ch.unsubscribe(handler);
2020
}
@@ -28,9 +28,9 @@ const { AsyncLocalStorage } = require('async_hooks');
2828
ch.subscribe(optedHandler, { subscriberId: key });
2929
ch.subscribe(regularHandler); // no suppression
3030

31-
suppressed(key, () => {
31+
suppressed(key, common.mustCall(() => {
3232
ch.publish({});
33-
});
33+
}));
3434

3535
ch.unsubscribe(optedHandler);
3636
ch.unsubscribe(regularHandler);
@@ -48,16 +48,16 @@ const { AsyncLocalStorage } = require('async_hooks');
4848
ch.subscribe(h1, { subscriberId: k1 });
4949
ch.subscribe(h2, { subscriberId: k2 });
5050

51-
suppressed(k1, () => {
51+
suppressed(k1, common.mustCall(() => {
5252
ch.publish({});
53-
});
53+
}));
5454

5555
assert.strictEqual(h1Calls, 0);
5656
assert.strictEqual(h2Calls, 1);
5757

58-
suppressed(k2, () => {
58+
suppressed(k2, common.mustCall(() => {
5959
ch.publish({});
60-
});
60+
}));
6161

6262
assert.strictEqual(h1Calls, 1);
6363
assert.strictEqual(h2Calls, 1);
@@ -104,10 +104,10 @@ const { AsyncLocalStorage } = require('async_hooks');
104104
const handler = common.mustNotCall();
105105
ch.subscribe(handler, { subscriberId: key });
106106

107-
suppressed(key, async () => {
107+
suppressed(key, common.mustCall(async () => {
108108
await Promise.resolve();
109109
ch.publish({});
110-
}).then(common.mustCall(() => {
110+
})).then(common.mustCall(() => {
111111
ch.unsubscribe(handler);
112112
}));
113113
}
@@ -119,18 +119,18 @@ const { AsyncLocalStorage } = require('async_hooks');
119119
const handler = common.mustNotCall();
120120
ch.subscribe(handler, { subscriberId: key });
121121

122-
suppressed(key, async () => {
122+
suppressed(key, common.mustCall(async () => {
123123
await new Promise((resolve) => {
124-
setImmediate(() => {
124+
setImmediate(common.mustCall(() => {
125125
ch.publish({});
126126

127-
queueMicrotask(() => {
127+
queueMicrotask(common.mustCall(() => {
128128
ch.publish({});
129129
resolve();
130-
});
131-
});
130+
}));
131+
}));
132132
});
133-
}).then(common.mustCall(() => {
133+
})).then(common.mustCall(() => {
134134
ch.unsubscribe(handler);
135135
}));
136136
}
@@ -144,9 +144,9 @@ const { AsyncLocalStorage } = require('async_hooks');
144144
ch.unsubscribe(handler);
145145

146146
// Should not throw and should not be called
147-
suppressed(key, () => {
147+
suppressed(key, common.mustCall(() => {
148148
ch.publish({});
149-
});
149+
}));
150150

151151
}
152152

@@ -163,9 +163,9 @@ const { AsyncLocalStorage } = require('async_hooks');
163163
ch.subscribe(handler);
164164
ch.bindStore(als, common.mustNotCall(), { subscriberId: key });
165165

166-
suppressed(key, () => {
166+
suppressed(key, common.mustCall(() => {
167167
ch.publish({});
168-
});
168+
}));
169169

170170
ch.unsubscribe(handler);
171171
ch.unbindStore(als);

0 commit comments

Comments
 (0)