Implement server-side coverage command #1903
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running
flow coverageon the file below, in the Nuclide codebase, occupies the Flow server for two minutes on my machine:Nuclide/pkg/nuclide-reprint-js/lib/printers/complex/printLiteral.jsThis is because coverage is implemented using the
dump-typesserver command, which forces all of the types to be stringified and sent across the process boundary. The file above, for whatever reason, has types that are ridiculously long when stringified. To solve this, I've added a newcoveragecommand to the server, which simply returns a boolean depending on whether the region is covered or not. With this change, runningflow coverageon the file above is basically instantaneous, and the output is identical to the output without this change.I will follow up with another PR to add detailed coverage information to the JSON output, so Nuclide can switch from dump-types to coverage for its coverage display. Then we can get away from this pathological behavior.
Of course, this PR doesn't fix
dump-types. But it solves my immediate problem and seems like the right long-term call forcoverageanyway.