Error when executing Invoke-psake without parameters #27

Closed
Eskat0n opened this Issue Feb 14, 2012 · 8 comments

Comments

Projects
None yet
8 participants

Eskat0n commented Feb 14, 2012

The following error occurs when I'm executing Invoke-psake command without parameters intending to invoke default task in default.ps1 file in current directory. But then I am specifies either filename or task name (default in my case) Invoke-psake command executes correctly.

14.02.2012 11:39:59: An Error Occurred:
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At D:\Configuration\Tools\Psake\psake.psm1:274 char:26
+         Assert (test-path <<<<  $buildFile -pathType Leaf) ($msgs.error_build_file_not_found -f $buildFile)
    + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test
   PathCommand

khebbie commented Mar 24, 2012

Yep I get it too

The expectation seems to be: use psake.cmd or psake.ps1. Seem really odd to me... eliminates the benefit of the module/psm1.

Why is this psake team?

So I've updated psake.psm1 to default the build file as in psake.ps1. I'm trying to run what look like the tests via psake-buildTester.ps1, but I get some nastiness:

Invalid specification syntax. Specs should end with _should_pass or _should_fail. executing_module_function_that_depends_on_another_module_should_work.ps1

Before digging into these, are they expected to work?

baralong commented Aug 8, 2012

I've encountered this exact same problem. My fix was to change the initial failing line from

    if ($buildFile -and !(test-path $buildFile -pathType Leaf) -and (test-path $psake.config_default.buildFileName -pathType Leaf))

to

    if ((!$buildFile -or !(test-path $buildFile -pathType Leaf)) -and (test-path $psake.config_default.buildFileName -pathType Leaf))

for the exception in the test runner you need to change the name of executing_module_function_that_depends_on_another_module_should_work.ps1 to executing_module_function_that_depends_on_another_module_should_pass.ps1

Though after all that I still get 3 tests failing

This is still happening. Given that this example is the first one on the main psake page (https://github.com/psake/psake) it doesn't give a good impression to new users.

This is the same as #53. I have posted a fix there.
The issue stems from code to allow calling invoke-psake with targets defined, but using the default build script.

Owner

damianh commented Mar 31, 2014

I closed #53 so closing this too unless someone verifies that it's a problem with 4.3.1....

@damianh damianh closed this Mar 31, 2014

m1l4nj commented Aug 22, 2014

I am getting the same error but this time it's on line 111 (psake v4.3.2). It's fine if I specify 'default' as the task name or if I re-run invoke-psake command again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment