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

Add coverage to Try Flow #7871

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

goodmind
Copy link
Contributor

@goodmind goodmind commented Jul 2, 2019

Fixes #2854

image

@goodmind
Copy link
Contributor Author

/сс @mroch

Copy link
Contributor

@mroch mroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

how noisy will this be? we need some settings (parser options, flowconfig options, etc) and this could be one of them if we need to toggle it off.

src/flow_dot_js.ml Outdated Show resolved Hide resolved
let root = Path.dummy_path in
let content = Js.to_string js_content in
match parse_content filename content with
| Error _ -> failwith "parse error"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems too easy to hit. I'd say make it return a JSON error instead

Copy link
Contributor Author

@goodmind goodmind Jul 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe raise_js_error?

const flow = Promise.resolve(editor.getOption('flow'));
const sources = Promise.all([
flow
.then(flowProxy => flowProxy.coverage('-', text))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code has to run on older versions of flow. I guess the catch will handle that, but swallowing errors always comes back to bite me. if it returns a JSON error for parse errors instead of throwing, then you could return a similar error if flow.coverage == null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from catch?

Copy link
Contributor Author

@goodmind goodmind Jul 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not catching inside Promise.all, would kill whole sequence, checkContent wouldn't be called then
even if it is user-defined error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swallowing errors always comes back to bite me.

type-at-pos bites back, if you add console.error to type-at-pos catch it would complain about re_string_match not implemented 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goodmind goodmind added the Stalled Issues and PRs that are stalled. label Jul 27, 2019
@goodmind goodmind force-pushed the try-flow-coverage branch from 84fb954 to e90d123 Compare August 8, 2019 16:32
@goodmind
Copy link
Contributor Author

goodmind commented Aug 9, 2019

@mroch I added coverage checkbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Stalled Issues and PRs that are stalled. Website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Display coverage on Try Flow
3 participants