OpenFn / OpenFn/kit

CLI: strange logging in execute tests

Open
#327 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tech debt
Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

This is a reminder to look into some strange logging issues in the cli/test/execute/excecute.test.ts

// TODO if I pass a mock logger into the handler, the handler then
// goes and creates a real logger and passes it to the runtinme, which
// causes all sorts of logging
// Why isn't that affecting other tests?
// Why do I need this special handling here?

I also notice that even though logger.error is being called, the logger doesn't seem to register it. Certainly mockLogger._find isn't finding it. This might be a json logger thing?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the tests in cli/test/execute/excecute.test.ts and read the TODO about the mock logger, handler, runtime, and JSON logger. Trace why a real logger is created and why mockLogger._find does not see logger.error. Done means the execute tests have predictable logging and can assert the error call without unwanted real logging.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.