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

Option to include Debug.log logs with passing tests #127

Open
Viir opened this issue Jun 1, 2023 · 2 comments
Open

Option to include Debug.log logs with passing tests #127

Viir opened this issue Jun 1, 2023 · 2 comments

Comments

@Viir
Copy link

Viir commented Jun 1, 2023

I have a workflow where I would prefer to have elm-test-rs output the logs from Debug.log (for a subset of tests) also for succeeding tests, to inspect how some Elm functions work.
So I use one command to run all tests and then one where I filter to a subset of tests. The logs generated in all tests would be expensive to forward because these are more than 1000 times larger than the subset I want to inspect more closely.

elm-test-rs  --filter=single-test  # I want to inspect how some function works (Logs are < 10 Kilobytes)

elm-test-rs     # I want to see the number of passing/failing tests (Logs would be > 10 Megabytes, too much noise)

Does elm-test-rs offer an option to enable that?

In the interactive help, I discovered --report=consoleDebug, which to me seemed at first sight like it might do that, but that option does not lead to including logs from Debug.log

@mpizenberg
Copy link
Owner

Indeed, the logs are only displayed in the case of a failure. The code for the reporters lives in another repo, it is Elm code. Here is the line that adds the debug logs for example:

https://github.com/mpizenberg/elm-test-runner/blob/19ca6e228828e15714f8a307fae87714a4bfe6c3/src/ElmTestRunner/Reporter/ConsoleColor.elm#L87

PR is welcome. I think the things to do would be

  1. add a cli argument to always report debug logs (in this repo)
  2. pass that argument to the supervisor, that would be the templates/{node_supervisor.js,deno_supervisor.mjs} files and the corresponding rust code that instantiates these templates
  3. add that option to the reporter flags (in the elm repo https://github.com/mpizenberg/elm-test-runner/blob/19ca6e228828e15714f8a307fae87714a4bfe6c3/src/ElmTestRunner/Reporter.elm#L118)
  4. add the behavior to the relevant reporters (json, junit, console color https://github.com/mpizenberg/elm-test-runner/tree/19ca6e228828e15714f8a307fae87714a4bfe6c3/src/ElmTestRunner/Reporter)

Alternatively if this is a bit too much work to validate an idea, you can first deep clone this repo and just do step (4) with the reporter you use.

When compiling the elm-test-rs binary (cargo build --release) a pre-build step will replace the elm submodule in your ~/.elm/ elm home directory so that your modified elm reporter is used instead of the one published on elm packages.

@Viir
Copy link
Author

Viir commented Jun 4, 2023

Wow, thank you for the swift response and the detailed instructions!

I will try this approach. I hope to work on it soon.

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

2 participants