shellspec icon indicating copy to clipboard operation
shellspec copied to clipboard

BeforeAll runs for examples outside of focus

Open cbandy opened this issue 2 years ago • 0 comments

When I run the following spec file with shellspec -c . -F I see that both hooks run even though a single group has focus.

Is this intentional? Is there something I can or should do in my hooks to no-op outside of focus?

$ shellspec --version
0.28.1

$ shellspec -c . -F
** hook one **
** hook two **
Running: /bin/sh [sh]
.

Finished in 0.08 seconds (user 0.05 seconds, sys 0.04 seconds)
1 example, 0 failures


Notable examples: (Listed here do not affect your suite's status)

shellspec hook_spec.sh:16 # -) outer inner2 <example:16-19> 
# hook_spec.sh
hook_one() { echo '** hook one **'; }
hook_two() { echo '** hook two **'; }

Describe 'outer'
  Describe 'inner1'
    BeforeAll 'hook_one'
    Specify
      When call :
      The status should be success
    End
  End

  fDescribe 'inner2'
    BeforeAll 'hook_two'
    Specify
      When call :
      The status should be success
    End
  End
End

cbandy avatar Aug 06 '22 05:08 cbandy