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

Update New-MockObject examples to use type object as input #2609

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Jan 17, 2025

PR Summary

Updates New-MockObject with examples for using type objects to reference classes.
Fix #2564

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten
Copy link
Collaborator Author

fflaten commented Jan 17, 2025

CI failing, but works on my machine (and devcontainer). Help, someone? 😅

Index was out of range. Must be non-negative and less than or equal to the size of the collection. (Parameter 'index')

The line is $obj = [MyInternalClass]::new() - what index?

@fflaten fflaten marked this pull request as draft January 17, 2025 20:42
@nohwnd
Copy link
Member

nohwnd commented Jan 17, 2025

I also don't see it locally, some kind of confusion where [] is misinterpreted as indexing operator? I vaguely remember this as being some problem somewhere.

@nohwnd
Copy link
Member

nohwnd commented Jan 17, 2025

I know what is it now :P

@nohwnd
Copy link
Member

nohwnd commented Jan 17, 2025

you yourself told me what to do last time, and I saw it recently in zlocation, the bug with classes when running under coverage / profiler.

@fflaten
Copy link
Collaborator Author

fflaten commented Jan 17, 2025

Yeah, was about to add the ctor and a comment myself. Forgot CI runs with CC

@fflaten fflaten marked this pull request as ready for review January 17, 2025 21:30
@fflaten
Copy link
Collaborator Author

fflaten commented Jan 17, 2025

/backport to rel/5.x.x

Copy link

Started backporting to rel/5.x.x: https://github.com/pester/Pester/actions/runs/12837313182

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 this pull request may close these issues.

Cant use New-MockObject with custom class from within a module
2 participants