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

Support cider-test-run-test from the src NS #2958

Closed
MicahElliott opened this issue Dec 29, 2020 · 5 comments · Fixed by #3481
Closed

Support cider-test-run-test from the src NS #2958

MicahElliott opened this issue Dec 29, 2020 · 5 comments · Fixed by #3481
Labels
enhancement good first issue A simple tasks suitable for first-time contributors

Comments

@MicahElliott
Copy link

Presently, this can only be called from the test NS.

It would be nice if you could call cider-test-run-test from the src NS, instead of having to run the whole cider-test-run-ns-tests.

This should be possible if your deftest function is named consistently with the source function. So with point on source function foo, invoking cider-test-run-test would look for a corresponding test named foo or foo-test (considering that the style guide now now encourages it).

The only alternative I see now is using -with-filters but that's not too convenient.

@bbatsov bbatsov added enhancement good first issue A simple tasks suitable for first-time contributors labels Dec 29, 2020
@bbatsov
Copy link
Member

bbatsov commented Dec 30, 2020

That's a good idea and it should be fairly simple to implement.

@hodgiwabi
Copy link

Hi, I'd really like to work on this if there is still a desire for this functionality.
From my understanding, the desired functionality is for cider-test-run-test to function in a similar way to cider-test-run-ns-tests by searching for the foo-test namespace, but only for the single test at point instead of all tests in the ns?

@bbatsov
Copy link
Member

bbatsov commented Apr 7, 2021

I think the use case is the following:

  • I'm the foo ns
  • There I'm in the definition of bar (e.g. a function)
  • I run cider-test-run-test and it finds the matching test bar-test in a namespace called foo-test and runs it.

@MicahElliott
Copy link
Author

Seems to me the third bullet should read:

  • I run cider-test-run-test and it finds the matching test function bar-test in a namespace called foo-test and runs it.

vemv added a commit that referenced this issue Sep 25, 2023
Fixes #2958
Fixes #3279

Co-authored-by: tvirolai <tvirolai@users.noreply.github.com>
vemv added a commit that referenced this issue Sep 25, 2023
Fixes #2958
Fixes #3279

Co-authored-by: tvirolai <tvirolai@users.noreply.github.com>
vemv added a commit that referenced this issue Sep 26, 2023
Fixes #2958
Fixes #3279

Co-authored-by: tvirolai <tvirolai@users.noreply.github.com>
@vemv
Copy link
Member

vemv commented Sep 26, 2023

CIDER master / 20230926.1139 features a revamped cider-test-run-test (run test at point).

Now, it will run the first valid test found at point for:

  • the current *cider-test-report* failure
  • deftests, and deftest-like forms (cider-test-defining-forms is no longer necessary and now deprecated) in the current namespace
  • :test metadata that may be present in vanilla defns
  • deftests for the current src/ defn, as found (and configurable) by cider-test-infer-test-ns
    • We search for a var named foo-test in that inferred ns, falling back to foo

Docs: https://docs.cider.mx/cider/testing/running_tests.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue A simple tasks suitable for first-time contributors
Projects
None yet
4 participants