foneandrew / ruby-spec-runner

Run specific rspec & minitest tests from within vscode
MIT License
9 stars 3 forks source link

add a "Run all examples" button as a **proof-of-concept** #2

Open steveclarke opened 1 year ago

steveclarke commented 1 year ago

It would be nice to have a "Run all examples/specs" button that's always visible. I had a quick look at the codebase and managed to put together this proof-of-concept for it.

As far as I can tell the extension is only activated when a spec file is opened, but for this to work we'd need to detect whether we're in a project/folder containing specs. Until I open a spec the button doesn't appear.

Is this something you're interested in incorporating? I'm willing to work on the feature if so.

foneandrew commented 1 year ago

Hey Steve sorry I haven't looked at this yet. My wife gave birth very unexpectedly on the weekend. I will check it out when I get some time

steveclarke commented 1 year ago

Hey Steve sorry I haven't looked at this yet. My wife gave birth very unexpectedly on the weekend. I will check it out when I get some time

Oh wow congratulations! I hope mom and baby are doing well!

No rush or pressure.

foneandrew commented 1 year ago

I like the idea.

For changing the activation event I think that should be fine. Code lens providers are already setup to only run for ruby files. We could add a bunch of language checks around the place I guess. Probably should do this anyway to prevent weird behaviour when running rspec on a js file etc.

if (editor.document.languageId !== 'ruby') {
  return // Or fire a more helpful notification off
}

As for getting results for multiple files at once, this will need a little bit of work. I ran the extension for a spec file, cancelled it in the terminal, and then edited the command and re-ran it using a path to a directory instead of a single file. rspec ran, but results were not available in editor for all files. This is due to the result syncing shenanigans. I have a branch with a bit of a hacky fix, but it needs more investigation (I suspect there will be side effects on exceptions etc). And there could be another better way to attack it too (reading from the file when it is not open in vscode)