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

How do I use the extension Pester Tests in VS Code with modules built with Sampler? #486

Open
DennisL68 opened this issue Aug 12, 2024 · 1 comment
Labels
waiting for author response The pull request is waiting for the author to respond to comments in the pull request.

Comments

@DennisL68
Copy link

Pester Tests keeps asking for the module when running one of the sample unit tests using VS Code...

An error occured running Pester: The specified module 'XXXX' was not loaded because no valid module file was found in any module directory.

@johlju
Copy link
Collaborator

johlju commented Aug 13, 2024

I tried this in the SqlServerDsc repo:

https://github.com/dsccommunity/SqlServerDsc/blob/3c3092976409645d74f58707331f66ffe1967127/.vscode/settings.json#L102-L111

Although it requires to run noop in the PowerShell Extension terminal for it to find the correct version of Pester before opening a test file (unless Pester is also installed as a user or machine module).

Also I had to add code to the tests to run noop task so everything is set up, but that is just required for testing classes as it need a new process each time.

https://github.com/dsccommunity/SqlServerDsc/blob/3c3092976409645d74f58707331f66ffe1967127/tests/Unit/Public/Add-SqlDscNode.Tests.ps1#L5-L25

@johlju johlju added question The issue is a question. waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed question The issue is a question. labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for author response The pull request is waiting for the author to respond to comments in the pull request.
Projects
None yet
Development

No branches or pull requests

2 participants