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

Feature request: focus on tests #898

Open
svantevonerichsen6906 opened this issue Jun 5, 2021 · 4 comments
Open

Feature request: focus on tests #898

svantevonerichsen6906 opened this issue Jun 5, 2021 · 4 comments

Comments

@svantevonerichsen6906
Copy link

Would it be possible for the test runners to allow focusing on single tests?

What I have in mind is similar to what lein-test-refresh does: https://github.com/jakemcc/lein-test-refresh#built-in-test-narrowing-test-selector. You mark one or more tests with a metadata flag, and then only those get executed.

I think that it should be possible to build this into https://github.com/thheller/shadow-cljs/blob/8169e663c0338ab01b31726b0cfcd7005563c581/src/main/shadow/test/env.clj, but I think it should be activated by a parameter so that you don't accidentally forget a focus mark and disable most tests of an automatic pipeline.

@thheller
Copy link
Owner

thheller commented Jun 5, 2021

A basic version is already supported for :node-test, eg. node out/test.js --test=some.ns/foo-test. See https://github.com/thheller/shadow-cljs/blob/8169e663c0338ab01b31726b0cfcd7005563c581/src/main/shadow/test/node.cljs

That could be smarter of course. PR welcome.

@logseq-cldwalker
Copy link

logseq-cldwalker commented Feb 24, 2022

@thheller I built this node test runner at work which supports the same test selection options as https://github.com/cognitect-labs/test-runner#invoke-with-clojure--m-clojuremain. Would you like a PR to shadow.test.node to incorporate those options?

@thheller
Copy link
Owner

Can you write this as a standalone ns that doesn't use shadow.test.node? Just copy whatever you need from it over and adjust. I'd be open to an option that keeps the existing --test just so that people using that can continue to do so.

@logseq-cldwalker
Copy link

logseq-cldwalker commented Feb 25, 2022

Can you write this as a standalone ns that doesn't use shadow.test.node? Just copy whatever you need from it over and adjust

Great that you're interested! Sure. I'd just name it shadow.test.node-test-runner unless you have another preferred name

I'd be open to an option that keeps the existing --test just so that people using that can continue to do so

The -v or --var already provides the functionality. We could alias it to --test if you'd like

Is there a place I could document usage of the options?

We're just starting to use this at work. My plan is to use the runner a week or two before creating a shadow-cljs PR so I can squash any bugs quickly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants