OpenFn/kit

Tests: suppress the OPENFN_REPO_DIR env var warning

Open

#846 opened on Dec 17, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (19 forks)auto 404
DevXgood first issuetech debt

Repository metrics

Stars
 (20 stars)
PR merge metrics
 (PR metrics pending)

Description

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

Contributor guide