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

Tests: suppress the OPENFN_REPO_DIR env var warning #846

Open
josephjclark opened this issue Dec 17, 2024 · 1 comment
Open

Tests: suppress the OPENFN_REPO_DIR env var warning #846

josephjclark opened this issue Dec 17, 2024 · 1 comment
Labels
good first issue Good for newcomers tech debt Non-critical, invisible code issues that ought to be addressed

Comments

@josephjclark
Copy link
Collaborator

The CLI tests don't set the OPENFN_REPO_DIR env var

That means that each test logs a warning:

WARNING: no repo module dir found! Using the default (/tmp/repo)
packages/cli test: You should set OPENFN_REPO_DIR or pass --repoDir=some/path in to the CLI

This happens before the CLI has created a logger, so we can't put a mock logger here to test or suppress this is message. And while this logging doesn't actually matter, it is pretty annoying.

Options:

  1. Force the env var value in unit tests. Not unreasonable. We should set to the default value though.
  2. Add an option somewhere to supress this warning, like --no-warnings
  3. Remove the warning. Is it really necessary? Well maybe, I'm not wild about the tmp dir being used for the repo, and would prefer users set a sensible location on their machine
@github-project-automation github-project-automation bot moved this to New Issues in v2 Dec 17, 2024
@josephjclark
Copy link
Collaborator Author

I would set the env var (if it's not already set) at the top of the relevant unit tests . It's probably a good idea to set up a clean temporary repo dir at the start of CLI tests anyway, just in case the tests start accidentally using a folder on the user's drive.

@josephjclark josephjclark added good first issue Good for newcomers tech debt Non-critical, invisible code issues that ought to be addressed labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers tech debt Non-critical, invisible code issues that ought to be addressed
Projects
Status: New Issues
Development

No branches or pull requests

1 participant