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

flow test --output=json does not strictly emit JSON data #1324

Open
jribbink opened this issue Jan 2, 2024 · 1 comment
Open

flow test --output=json does not strictly emit JSON data #1324

jribbink opened this issue Jan 2, 2024 · 1 comment
Assignees
Labels

Comments

@jribbink
Copy link
Contributor

jribbink commented Jan 2, 2024

Instructions

Please fill out the template below to the best of your ability and include a label indicating which tool/service you were working with when you encountered the problem.

Problem

Logs outputted by flow test --output=json are not captured in any way and are emitted to stdio as plaintext. This is problematic because applications which rely on this functionality will fail to parse the output from the Flow CLI.

Steps to Reproduce

Run the command with a test file that emits a log.

Acceptance Criteria

The CLI strictly emits JSON output to stdio. There are multiple solutions for this:

  • Suppress logs entirely (probably the easy quick-fix that can be revisited later)
  • Extend the output of flow test to include logs. It's likely this could introduce some breaking changes to the schema of the CLI output and break external consumers, however, this is a relatively new feature so this is probably acceptable in order to migrate to a more robust output format in the long-run.
  • Output logs directly to stdio in JSON format and stream multiple messages in realtime (this is similar to flow emulator --log-format json, however requires all consumers be equipped to handle multiple JSON objects in the output). It does, however, offer the benefit of instantly serving in-progress information without waiting for a terminal state.

Context

Currently cadence log() calls break the VSCode Test Runner.

This relies on changes to the Cadence Test Framework (see onflow/cadence-tools#265 onflow/cadence-tools#267)

@jribbink
Copy link
Contributor Author

jribbink commented Jan 4, 2024

cadence-tools/test@v0.14.6 was released with a default suppressed logger. Simply upgrading to this version will prevent this error, however more work should be done so that there is no regression in the logs available (either use runner.Logs or preserve logger behaviour in "text" output format)

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

No branches or pull requests

2 participants