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

Respect ROARR_LOG while running Jest UI tests #83

Open
shishrao opened this issue Nov 28, 2023 · 0 comments
Open

Respect ROARR_LOG while running Jest UI tests #83

shishrao opened this issue Nov 28, 2023 · 0 comments

Comments

@shishrao
Copy link

shishrao commented Nov 28, 2023

Currently, ROARR_LOG is not respected while running Jest tests as Jest runner mocks window object while running tests. While any console.log within jest can be turned off with --silent there's no way to prevent logs generated by roarr.

Suggestion:

Update createLogger conditional check with...

if (
    typeof process !== 'undefined' && (
        !isBrowser() // Not running in a browser
        || process.env.JEST_WORKER_ID !== undefined // Running in Jest test environment
        || process.env.SOME_OTHER_ID !== undefined // Running in other test environment
    )
) { ... }

...to allow ROARR_LOG to be respected across test environments that are mocking window.

Ref: https://jestjs.io/docs/environment-variables

Ways to get around this is to downgrade from 7.21.0 (7.5.0 worked as it uses isNodeEnvironment check. Haven't tested all versions in between) or to override ROARR.write in jest node environment (not recommended)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant