-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Using --format=json
with --nocapture
#54669
Labels
A-libtest
Area: `#[test]` / the `test` library
T-dev-tools
Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Comments
5 tasks
bors bot
added a commit
to intellij-rust/intellij-rust
that referenced
this issue
Oct 11, 2018
2901: RUN: Support test window r=vlad20012 a=mchernyavsky Closes #1485. This PR is mostly based on #2337 (a huge thanks to @farodin91 and @mkaput). <img width="640" alt="screen shot 2018-10-09 at 22 13 58" src="https://user-images.githubusercontent.com/6079006/46692771-c61afa80-cc10-11e8-8281-e91a9309c3d3.png"> I had to remove the `--nocapture` option because of rust-lang/rust#54669. TODO: - [x] Provide execution time of each test - [x] Provide location hint and proper line marker for test suites - [ ] Add more tests What else can be implemented/improved? - [ ] Add more filters - [ ] Support "Run only tests that failed/crashed after last run" Co-authored-by: Jansen Jan <farodin91@sek-server.de> Co-authored-by: Jan Jansen <farodin91@googlemail.com> Co-authored-by: Mikhail Chernyavsky <chemike47@gmail.com>
bors bot
added a commit
to intellij-rust/intellij-rust
that referenced
this issue
Oct 11, 2018
2901: RUN: Support test window r=vlad20012 a=mchernyavsky Closes #1485. This PR is mostly based on #2337 (a huge thanks to @farodin91 and @mkaput). <img width="640" alt="screen shot 2018-10-09 at 22 13 58" src="https://user-images.githubusercontent.com/6079006/46692771-c61afa80-cc10-11e8-8281-e91a9309c3d3.png"> I had to remove the `--nocapture` option because of rust-lang/rust#54669. TODO: - [x] Provide execution time of each test - [x] Provide location hint and proper line marker for test suites - [ ] Add more tests What else can be implemented/improved? - [ ] Add more filters - [ ] Support "Run only tests that failed/crashed after last run" Co-authored-by: Jansen Jan <farodin91@sek-server.de> Co-authored-by: Jan Jansen <farodin91@googlemail.com> Co-authored-by: Mikhail Chernyavsky <chemike47@gmail.com>
bors bot
added a commit
to intellij-rust/intellij-rust
that referenced
this issue
Oct 11, 2018
2901: RUN: Support test window r=vlad20012 a=mchernyavsky Closes #1485. This PR is mostly based on #2337 (a huge thanks to @farodin91 and @mkaput). <img width="640" alt="screen shot 2018-10-09 at 22 13 58" src="https://user-images.githubusercontent.com/6079006/46692771-c61afa80-cc10-11e8-8281-e91a9309c3d3.png"> I had to remove the `--nocapture` option because of rust-lang/rust#54669. TODO: - [x] Provide execution time of each test - [x] Provide location hint and proper line marker for test suites - [ ] Add more tests What else can be implemented/improved? - [ ] Add more filters - [ ] Support "Run only tests that failed/crashed after last run" Co-authored-by: Jansen Jan <farodin91@sek-server.de> Co-authored-by: Jan Jansen <farodin91@googlemail.com> Co-authored-by: Mikhail Chernyavsky <chemike47@gmail.com>
bors bot
added a commit
to intellij-rust/intellij-rust
that referenced
this issue
Nov 7, 2018
3004: RUN: Support `--nocapture` option r=vlad20012 a=mchernyavsky Closes #2979. Restores a checkbox in the `Edit Configurations` that has been removed in [this PR](#2901). If this checkbox is selected, the `--nocapture` option will be used in the tests. The checkbox not selected by default. At the moment, the test window can't work with `--nocapture` (see rust-lang/rust#54669), so when the checkbox is activated, the test results will be displayed in the old-style console. <img width="500" alt="Edit Configuration Menu" src="https://user-images.githubusercontent.com/6079006/47786381-add46200-dd1c-11e8-946a-6c4e6f1cdf1f.png"> Co-authored-by: Mikhail Chernyavsky <chemike47@gmail.com>
Centril
added a commit
to Centril/rust
that referenced
this issue
Aug 27, 2019
…=gnzlbg libtest: add --show-output flag to print stdout of successful tests This pull request adds a new flag `--show-output` for tests to show the output of successful tests. For most formatters this was already supported just not exposed via the CLI (apparently only used by `librustdoc`). I've also added support for this option in the JSON formatter. This kind of fixes rust-lang#54669 which wants `--format json` to work with `--nocapture`, which is... well, impossible. What this issue really calls for is `--show-output` as implemented here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-libtest
Area: `#[test]` / the `test` library
T-dev-tools
Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
I'm looking for a way to get test results, including stdout/stderr, in json format.
I've tried to use
--format=json
with--nocapture
and have got an unexpected result, imo.Example file:
cargo test -- -Z unstable-options --format=json
output:cargo test -- --nocapture -Z unstable-options --format=json
output:I expected to see this happen:
Hello from test #1
line doesn't appear in thestdout
field.println!
output and errors are recorded in different fields (e.g.stdout
andstderr
).Expected behavior can be useful for integrating test frameworks with IDEs and editors.
I'm using:
The text was updated successfully, but these errors were encountered: