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

silenceMessage still prints the message even if silenced. #97

Open
dagadbm opened this issue Feb 8, 2025 · 0 comments
Open

silenceMessage still prints the message even if silenced. #97

dagadbm opened this issue Feb 8, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@dagadbm
Copy link

dagadbm commented Feb 8, 2025

Bug description

silenceMessage still prints message even when returning true

Description

failOnConsole({
  shouldFailOnWarn: true,
  shouldFailOnError: true,
  silenceMessage(message, method) {
    const ignoredErrors = [
      'This is a no-op, but it indicates a memory leak in your application.',
    ];
    const ignoredWarnings = [
      'This is a no-op, but it indicates a memory leak in your application',
    ];

    if (
      (method === 'warn' && ignoredWarnings.some((msg) => message.includes(msg))) ||
      (method === 'error' && ignoredErrors.some((msg) => message.includes(msg)))
    ) {
      return true;
    }
    return false;
  },
});

Expected outcome

no message being printed at all!

Actual outcome

The test does not fail, but it prints the message:

stderr | client/app/pages/settings/__tests__/Settings.test.tsx > OrganisationSettings > renders correctly for single user
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    at OrganizationSettings 
     ...

Screenshots / Video / StackTrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant