Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use Set.difference() #53597

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions test/parallel/test-bootstrap-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ if (process.env.NODE_V8_COVERAGE) {
expected.atRunTime.add('Internal Binding profiler');
}

const difference = (setA, setB) => {
return new Set([...setA].filter((x) => !setB.has(x)));
};

// Accumulate all the errors and print them at the end instead of throwing
// immediately which makes it harder to update the test.
const errorLogs = [];
Expand All @@ -187,8 +183,8 @@ function err(message) {
}

if (common.isMainThread) {
const missing = difference(expected.beforePreExec, actual.beforePreExec);
const extra = difference(actual.beforePreExec, expected.beforePreExec);
const missing = expected.beforePreExec.difference(actual.beforePreExec);
const extra = actual.beforePreExec.difference(expected.beforePreExec);
if (missing.size !== 0) {
err('These builtins are now no longer loaded before pre-execution.');
err('If this is intentional, remove them from `expected.beforePreExec`.');
Expand Down Expand Up @@ -222,8 +218,8 @@ if (!common.isMainThread) {
}

{
const missing = difference(expected.atRunTime, actual.atRunTime);
const extra = difference(actual.atRunTime, expected.atRunTime);
const missing = expected.atRunTime.difference(actual.atRunTime);
const extra = actual.atRunTime.difference(expected.atRunTime);
if (missing.size !== 0) {
err('These builtins are now no longer loaded at run time.');
err('If this is intentional, remove them from `expected.atRunTime`.');
Expand Down
Loading