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

allow ignoring tests #46

Open
amtoine opened this issue Nov 8, 2023 · 2 comments
Open

allow ignoring tests #46

amtoine opened this issue Nov 8, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@amtoine
Copy link
Member

amtoine commented Nov 8, 2023

i have a test in nu-git-manager that cannot run for now and thus i thought it would be cool to ignore it.

Description

for now, the only way to ignore a test is to not export it.
however, by doing so, the test won't appear in the output of nupm test...

i think it would be cool to support something like

# tests/mod.nu
export def my-test-ignore [] {
    # ...
}

and still have my-test appear in yellow next to the other ones 😋

Testing package /path/to/my-package
tests test-fail-1 ... FAIL
tests test-fail-3 ... FAIL
tests test-success ... SUCCESS
tests test-ignore-1 ... IGNORE
tests test-fail-2 ... FAIL
tests test-ignore-2 ... IGNORE
Ran 5 tests. 1 succeeded, 2 ignored, 3 failed.
@amtoine amtoine added the enhancement New feature or request label Nov 8, 2023
@NonlinearFruit
Copy link

NonlinearFruit commented Jan 24, 2024

A big draw back to using the test name is if you have a test like ignore-node-modules or similar would be skipped

But definitely a way to skip tests without modifying them would be awesome

@vyadh
Copy link

vyadh commented Oct 26, 2024

I didn't actually see what nupm was doing to run tests (I initially assumed it was written in Rust) but I see it's doing similar to my recent PR to the documentation that illustrates a tiny embedded test runner method that does something very similar.

That ignores tests like this:

# ignore
def test_fib_ignored_test [] {
  print "This test will not be executed"
}

by doing

 scope commands
      | where ($it.name | str starts-with "test_")
      | where not ($it.description | str starts-with "ignore")
     # ...

I imagine there is a whole bunch of stuff that could be driven from description instructions. E.g. running a test method with different test data.

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

No branches or pull requests

3 participants