Skip to content

Exceptions in Context should fail all tests in scope #79

@staxmanade

Description

@staxmanade

If I have some code in the Context for setup purposes that fails, it would be great if the project would consider one of the two strategies below:

  1. Consider failing each It assertion/test with the same exception.
  2. Only report one error (relaying the fact that an error in the context setup failed)

Thoughts?

Example:

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
. "$here\$sut"

Describe "SomeDescribe" {
  Context "When some Context runs and an error happens" {

      throw "some error during setup"

      It "Should report something" {
          # This test should not even run (but possibly fail with the error from the context setup)
      }
      It "Should report something else" {
          # This test should not even run (but possibly fail with the error from the context setup)
      }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions