This topic contains 8 replies, has 3 voices, and was last updated by
April 9, 2016 at 5:29 am #37470
Putting together my first appveyor/pester test for a module and failing miserably. Integration is all working, but when I do an Import-Module in my pester test it simply doesn't import the functions. It *says* it is but nothing gets imported. I've tried Get-Command -Module TestSQL after the import.
Anyone seen anything like this? Not sure what information I can provide but happy to post the pester scripts/yml if needed.
April 9, 2016 at 7:42 am #37471MemberPoints: 0Rank: Member
Will need to see the code, not sure what's going on based on your description so far.
April 9, 2016 at 7:53 am #37472MemberPoints: 0Rank: Member
Found it on GitHub. 🙂 Two things jumped out at me:
You've got RootModule = 'TestSQL' ; this might need to say 'TestSQL.psm1'. I've never tried it without an extension before.
In your Tests.ps1 file, you're using an absolute path for the import: https://github.com/martin9700/TestSQL/blob/master/Source/Test/Invoke-SQLQuery.tests.ps1#L3
Personally, I would always use a relative path here:
But since your appveyor job seems to be set up to clone to the same absolute path that's mentioned in the Tests.ps1 script, that may be fine.
April 9, 2016 at 1:07 pm #37474
Hi Dave, I've always done just the Folder name there. I should note that this all works fine on my PC, so it's definitely a appveyor thing. I do have explicit paths in there right now as I'm just getting this off the ground for now, but I have big plans (bwahahaha)
Anyway, the module looks like it's loading, but when I do Get-Command -Module TestSQL I get nothing (see below). G1, G2 and G3 are all locators where I do the Get-Command right after.
April 9, 2016 at 1:10 pm #37475
That said, will give it a try. Syncing now, and build is queued. Have to run out to dinner (argh!) so I'll update later tonight on pass/fail.
April 9, 2016 at 3:06 pm #37476
Just an update. Same problem as above. Module looks like it loads, but then none of the functions are there.
April 10, 2016 at 6:45 am #37487
Wanted to leave a last update. Loading the module using just the folder name still fails. Funny enough, this happened before when RootModule didn't have the name of the folder in it on an earlier version of my module creation script.
That data is there now and still won't load in appveyor, however, I did get the functions to load if I specified the PSM1 extension. I suspect some kind of issue with the manifest file, but it works fine on a regular PC (hah, on "my" PC, famous last words) and this seems to be simply an Appveyor problem.
So, now I have to get SQL properly configured so the module can be tested. Why did I pick this as my first Appveyor project?!
April 10, 2016 at 6:47 pm #37491ParticipantPoints: 0Rank: Member
Try changing functions to export in your manifest to an array of strings rather than one big string.
April 11, 2016 at 4:41 am #37502
Hey Tom, I thought I had fixed that! Was using a hashtable and the .Keys property but it's interested how New-ModuleManifest and Update-ModuleManifest treat that differently! I originally had something else in mind which is why I used a hashtable in this instance but that requirement went away so I think I'll just switch over to an Array.List instead and that should resolve that problem.
The topic ‘Pester test on Appveyor not importing my module’ is closed to new replies.