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

Option to suppress "Skipped" messages #453

Open
jcmrva opened this issue May 2, 2023 · 3 comments · May be fixed by #511
Open

Option to suppress "Skipped" messages #453

jcmrva opened this issue May 2, 2023 · 3 comments · May be fixed by #511

Comments

@jcmrva
Copy link

jcmrva commented May 2, 2023

This would be particularly useful when focusing a test, or list of tests.

We have hundreds of tests, so focusing results in a flood of messages.

@ratsclub
Copy link
Collaborator

ratsclub commented Jun 2, 2023

Hello, @jcmrva

Can you provide a small example of a code that does what you described?

@rynoV
Copy link
Contributor

rynoV commented Sep 10, 2024

I would also like to see this option.

@ratsclub For example with the test suite

let tests =
    testList
        "A test group"
        [ test "one test" { Expect.equal (2 + 2) 4 "2+2" }

          ftest "another test that fails" { Expect.equal (3 + 3) 5 "3+3" }

          testAsync "this is an async test" {
              let! x = async { return 4 }
              Expect.equal x (2 + 2) "2+2"
          } ]
    |> testLabel "samples"
[11:14:07 DBG] samples.A test group.one test starting... <Expecto>
[11:14:07 DBG] samples.A test group.one test was ignored. The test is skipped because other tests are Focused <Expecto>
[11:14:07 DBG] samples.A test group.another test that fails starting... <Expecto>
[11:14:07 ERR] samples.A test group.another test that fails failed in 00:00:00.0290000. 
3+3.
expected: 5
  actual: 6
   at Program.Pipe #2 input at line 15@19-1.Invoke(Unit unitVar) in Program.fs:line 19
   at Expecto.Impl.execTestAsync@566-1.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 510
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\FSharp.Core\async.fs:line 112 <Expecto>
[11:14:07 DBG] samples.A test group.this is an async test starting... <Expecto>
[11:14:07 DBG] samples.A test group.this is an async test was ignored. The test is skipped because other tests are Focused <Expecto>
[11:14:07 INF] EXPECTO! 1 tests run in 00:00:00.0730025 for samples.A test group - 0 passed, 2 ignored, 1 failed, 0 errored.  <Expecto>

The option would skip over the messages
"<test> starting..."
"<test> was ignored. The test is skipped because other tests are Focused"

@rynoV
Copy link
Contributor

rynoV commented Sep 10, 2024

A workaround:

        runTestsWithCLIArgs
            [ Printer
                  { Impl.TestPrinters.defaultPrinter with
                      beforeEach = fun _ -> async { () }
                      ignored = fun _ _ -> async { () } } ]
            args tests
 

Although not ideal because the "test starting" message for the running test isn't shown

rynoV added a commit to Auspice-Capital/expecto that referenced this issue Sep 10, 2024
rynoV added a commit to Auspice-Capital/expecto that referenced this issue Sep 10, 2024
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

Successfully merging a pull request may close this issue.

3 participants