Variable empty within It but given in Context

Welcome Forums Pester Variable empty within It but given in Context

Viewing 4 reply threads
  • Author
    Posts
    • #235141
      Participant
      Topics: 2
      Replies: 2
      Points: 28
      Rank: Member

      Hi *,

      I have a Pester test with Test-ModuleManifest throwing an error now (worked before).
      Very strange: it seems that it is an issue also connected to AppVeyor as it works locally.

      The issue:

      This throws an error about -Path cant be bound as it is null.

      Funny: my debugging output just outside of It is working fine and returning the right Path to my Manifest which is defined on top of all tests.

      Any ideas?

      Thanks,
      M.

      • This topic was modified 3 months, 1 week ago by kvprasoon. Reason: code formatting
    • #235240
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,781
      Helping Hand
      Rank: Community Hero

      Where is the $ModuleManifestPath defined ? did you change pester version and what is the pester version you use ?

    • #235627
      Participant
      Topics: 2
      Replies: 2
      Points: 28
      Rank: Member

      Hi @kvprasoon

      it is latest Pester on all systems (5.0.2 as I remember).

      On AppVeyor and Azure Pipeline it is not working (both), locally (Win10) it is working.

      I define the vars directly on top of my Test-Script, before first describe:

      The problematic test can be seen in my original post, within Context, before It the var has the content I want. Within It it seems to be empty.

      Best,
      M.

    • #235864
      Participant
      Topics: 2
      Replies: 2
      Points: 28
      Rank: Member

      Solved it: since v5 you have to put all in some BeforeAll{} context, otherwise it may not work.

    • #236065
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,781
      Helping Hand
      Rank: Community Hero

      Thanks for letting us know the cause.

Viewing 4 reply threads
  • The topic ‘Variable empty within It but given in Context’ is closed to new replies.