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

Is it possible to get cargo's output as json? #1403

Closed
sbstp opened this Issue Mar 10, 2015 · 11 comments

Comments

Projects
None yet
7 participants
@sbstp
Copy link

sbstp commented Mar 10, 2015

I'd like to integrate cargo into Atom (the text editor) and I was wondering if it is possible to get the commands' result as json. I'd like to be able to get errors and their line number from cargo build as well as test results from cargo test.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 10, 2015

Unfortunately no, this aspect of Cargo has not yet been implemented. Cargo is planned to have more tooling support with nice machine-readable output formats (like JSON or TOML). For test results, however, that would be a problem more of the testing framework than Cargo itself, so it may not necessarily be up to Cargo to do so.

@sbstp

This comment has been minimized.

Copy link
Author

sbstp commented Mar 10, 2015

What is the testing framework that cargo runs when you use cargo test?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 11, 2015

Currently it's libtest in the standard distribution.

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Mar 11, 2015

And we removed it fairly recently in an effort to streamline the runner, since we didn't want to stabilize it.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Mar 4, 2016

since rustc can now output json, at least cargo build could get a setting to output json

@matklad

This comment has been minimized.

Copy link
Member

matklad commented May 9, 2016

Can RUSTFLAGS env variable be used here?

@Boddlnagg

This comment has been minimized.

Copy link
Contributor

Boddlnagg commented Oct 6, 2016

No, it can't: rust-lang/rust#37011

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Dec 29, 2016

With --message-format=json now stable, I'm going to close this.

@aergonaut

This comment has been minimized.

Copy link

aergonaut commented May 18, 2017

Sorry to necropost, but I figured this issue was a good place to bring up this point than creating a new one.

Are there plans to add JSON output for cargo test results? While I see there's --message-format=json it looks like that only makes the build step output JSON, and the actual test results are still in the human-readable pretty format.

My motivation is that I want to build a Nuclide test runner provider for Atom, and it would be a lot easier to parse test results if they were output in JSON.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented May 19, 2017

@aergonaut ah the test framework (src/libtest/lib.rs in the rust-lang/rust repository) is actually somewhat separate from the current implementation of --message-format=json). It's definitely desired to have a more full-featured testing framework in the long run, though! We've long wanted the ability to have custom test frameworks to implement this logic.

@aergonaut

This comment has been minimized.

Copy link

aergonaut commented May 19, 2017

Thanks for the reply @alexcrichton. I'll look forward to hopefully seeing that RFC make progress in the future 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.