Skip to content

Running any pester tests shows Cannot read property '0' of undefined #3713

Closed
@majkinetor

Description

@majkinetor

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

Since recently (don't know when) when I run/debug pester tests (even empty ones), I get this error.

Cannot read property '0' of undefined

I had this working for years without problem.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.62.3
ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
x64

Extension Version

ms-vscode.powershell@2021.10.2

Pester Version

5.3.1

Steps to Reproduce

I created a file foo.tests.ps1

[Run tests] | [Debug tests]
Describe 'meh' {

}

When I click any, I got that error.

I removed AppData\Roaming\Code and .vscode and it still happens.

Visuals

No response

Logs

Extension log
7.12.2021. 11:36:48 [NORMAL] - Visual Studio Code v1.62.3 64-bit
7.12.2021. 11:36:48 [NORMAL] - PowerShell Extension v2021.10.2
7.12.2021. 11:36:48 [NORMAL] - Operating System: Windows 64-bit
7.12.2021. 11:36:48 [NORMAL] - Language server starting --
7.12.2021. 11:36:48 [NORMAL] -     PowerShell executable: C:\Program Files\PowerShell\7\pwsh.exe
7.12.2021. 11:36:48 [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.10.2 <=====
' -LogLevel 'Diagnostic' -LogPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\logs\1638873408-8b3ccd27-5ecb-412b-b618-3193cd3fdb981638873389306\EditorServices.log' -SessionDetailsPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\sessions\PSES-VSCode-16116-696739' -FeatureFlags @() 
7.12.2021. 11:36:48 [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2021.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\modules' -EnableConsoleRepl -StartupBanner '=====> PowerShell Integrated Console v2021.10.2 <=====
' -LogLevel 'Diagnostic' -LogPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\logs\1638873408-8b3ccd27-5ecb-412b-b618-3193cd3fdb981638873389306\EditorServices.log' -SessionDetailsPath 'c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\sessions\PSES-VSCode-16116-696739' -FeatureFlags @() 
7.12.2021. 11:36:48 [NORMAL] - pwsh.exe started.
7.12.2021. 11:36:48 [NORMAL] - Waiting for session file
7.12.2021. 11:36:50 [NORMAL] - Session file found
7.12.2021. 11:36:50 [NORMAL] - Registering terminal close callback
7.12.2021. 11:36:50 [NORMAL] - Registering terminal PID log callback
7.12.2021. 11:36:50 [NORMAL] - pwsh.exe PID: 8356
7.12.2021. 11:36:50 [NORMAL] - Language server started.
7.12.2021. 11:36:50 [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_kigvqssr.ns2","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_am5sbfhb.itf"}
7.12.2021. 11:36:50 [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_kigvqssr.ns2...
7.12.2021. 11:36:50 [NORMAL] - Language service connected.
exthost.log
[2021-12-07 11:36:30.011] [exthost] [info] Extension host with pid 14632 started
[2021-12-07 11:36:30.143] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2021-12-07 11:36:30.150] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2021-12-07 11:36:30.153] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*', root cause: vscode.github
[2021-12-07 11:36:30.317] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
[2021-12-07 11:36:30.334] [exthost] [info] Eager extensions activated
[2021-12-07 11:36:30.338] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[2021-12-07 11:36:30.340] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished'
[2021-12-07 11:36:30.365] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
[2021-12-07 11:36:48.494] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.powershell, startup: false, activationEvent: 'onLanguage:powershell'
[2021-12-07 11:36:55.331] [exthost] [error] TypeError: Cannot read property '0' of undefined
	at I1.<anonymous> (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:105:6685)
	at Generator.next (<anonymous>)
	at c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:1:970
	at new Promise (<anonymous>)
	at Ee (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:1:790)
	at I1.launch (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:105:6399)
	at I1.<anonymous> (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:105:5538)
	at Generator.next (<anonymous>)
	at c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:1:970
	at new Promise (<anonymous>)
	at Ee (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:1:790)
	at I1.launchTests (c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:105:5452)
	at c:\Users\mmilic\.vscode\extensions\ms-vscode.powershell-2021.10.2\out\main.js:105:5182
	at o._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111751)
	at o._doExecuteCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:110639)
	at o.executeCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:110545)
	at v._executeConvertedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:114105)
	at o._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111751)
	at o.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:112293)
	at n._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:13802)
	at n._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:13486)
	at n._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:12148)
	at n._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:10826)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:98:8922
	at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
	at s.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:15990)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:113:30625
	at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
	at s.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:15990)
	at f._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:21260)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:18138
	at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
	at w.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:13351)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:12699
	at Socket.m (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:113:13575)
	at Socket.emit (events.js:315:20)
	at addChunk (internal/streams/readable.js:309:12)
	at readableAddChunk (internal/streams/readable.js:284:9)
	at Socket.Readable.push (internal/streams/readable.js:223:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) PowerShell.RunPesterTests {"value":"ms-vscode.powershell","_lower":"ms-vscode.powershell"}

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions