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

Testing should assert the expected name of console methods #2656

Open
gibson042 opened this issue Dec 6, 2024 · 0 comments
Open

Testing should assert the expected name of console methods #2656

gibson042 opened this issue Dec 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gibson042
Copy link
Contributor

What is the Problem Being Solved?

As noted in #2654 (review) , it would be nice to cover the expected name of [virtual] console methods.

Description of the Design

e.g.,

const keysToCheck = new Set([
  ...consoleLevelMethods,
  ...consoleOtherMethods,
  ...Reflect.ownKeys(console),
]);
for (const key of keysToCheck) {
  const value = console[key];
  if (typeof value === 'function') {
    const expectedName = typeof key === 'symbol'
      ? `[${key.description}]`
      : key;
    t.is(value.name, expectedName, `console.${String(key)}.name`);
  }
}

for the console object returned by use of makeLoggingConsoleKit/makeCausalConsole/filterConsole/etc.

Security Considerations

n/a

Scaling Considerations

n/a

Test Plan

Refer to the above design.

Compatibility Considerations

n/a

Upgrade Considerations

n/a

@gibson042 gibson042 added the enhancement New feature or request label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant