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

way of silencing 'this run has ID <…>' ? #313

Open
c-cube opened this issue Jul 13, 2021 · 2 comments
Open

way of silencing 'this run has ID <…>' ? #313

c-cube opened this issue Jul 13, 2021 · 2 comments

Comments

@c-cube
Copy link

c-cube commented Jul 13, 2021

I'm trying to turn a (failing) alcotest binary into a dune expect test, but it's unreproducible because of one line: This test has ID ….. Is there a way to either silence this line, or set an ID via the environment?

@craigfe
Copy link
Member

craigfe commented Jul 13, 2021

AFAIK, there is no such existing feature. In Alcotest's own test suite, we strip such non-deterministic output with a separate binary. In addition to the random ID, we also have to account for:

  • differences in printed filepaths on various platforms;
  • variations in reported duration of the test run;
  • some changes to OCaml's exception reporting for different OCaml versions – perhaps not an issue for you.

Additionally, Alcotest's default output format has been historically quite unstable, so snapshotting it while consuming it as a library may prove frustrating. I was going to suggest using .. --json 2>/dev/null, but it seems that --json still logs non-JSON lines to standard out. (This is likely a mistake, and can/should be fixed separately.)

I'm interested in knowing what information the snapshot is intended to hold: perhaps the binary contains both passing and failing cases and the goal is to record which is which?

@c-cube
Copy link
Author

c-cube commented Jul 13, 2021

Indeed, so far I've been using a small shell script that captures the output and then uses sed and grep -v to remove parts of it.

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