pester / vscode-adapter

Run PowerShell Pester Tests with Visual Studio Code
MIT License
58 stars 14 forks source link

Into VSCode ARM M1Pro installation unhandled error in resolveHandler #125

Closed giulianolatini closed 1 year ago

giulianolatini commented 2 years ago

When I run pester test extension into VScode ARM on my MacBookPro with M1Pro, I can't see red/green notifier on the test summary or other indication on the tests' code. If I play the tests in the console, I see the running test write-out output.

Powershell Version:

image

What I see on display

image

Output error in VSCode log. This message is repeated three times:

[Extension Host] Unhandled error in resolveHandler of test controller "Pester" SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at Transform.transform [as _transform] (/Users/giulianolatini/.vscode/extensions/pspester.pester-test-2022.3.3/dist/extension.js:24:9482)
    at Transform._write (node:internal/streams/transform:184:23)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Transform.Writable.write (node:internal/streams/writable:334:10)
    at xt.ondata (node:internal/streams/readable:754:22)
    at xt.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at xt.Readable.push (node:internal/streams/readable:228:10)
    at xt._writeItem (/Users/giulianolatini/.vscode/extensions/pspester.pester-test-2022.3.3/dist/extension.js:1:1575)
    at xt._transform (/Users/giulianolatini/.vscode/extensions/pspester.pester-test-2022.3.3/dist/extension.js:1:1329)
    at xt.Transform._write (node:internal/streams/transform:184:23)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at xt.Writable.write (node:internal/streams/writable:334:10)
    at Socket.ondata (node:internal/streams/readable:754:22)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
mihaivilcuosf commented 1 year ago

I have the same issue in WSL > ubuntu

I added a console log before the JSON.parse and I get this error and this is what it's trying to parse:

[Extension Host] [?1h[?1l{"type":"Block","id":"/home/mihai/p/powershell/Math.Tests.ps1>>Get-Cactus","error":null,"file":"/home/mihai/p/powershell/Math.Tests.ps1","startLine":10,"endLine":15,"label":"Get-Cactus","result":7,"duration":0.0,"durationDetail":"(0ms|0ms)","message":null,"expected":null,"actual":null,"targetFile":null,"targetLine":-1,"parent":"/home/mihai/p/powershell/Math.Tests.ps1","tags":[]}
'[Extension Host] \x1B[?1h\x1B[?1l{"type":"Block","id":"/home/mihai/p/powershell/Math.Tests.ps1>>Get-Cactus","error":null,"file":"/home/mihai/p/powershell/Math.Tests.ps1","startLine":10,"endLine":15,"label":"Get-Cactus","result":7,"duration":0.0,"durationDetail":"(0ms|0ms)","message":null,"expected":null,"actual":null,"targetFile":null,"targetLine":-1,"parent":"/home/mihai/p/powershell/Math.Tests.ps1","tags":[]}'

It looks like the output from the psProcess has some escape sequences at the start. Not sure why they are added there.

johlju commented 1 year ago

Also tracked in this issue https://github.com/pester/vscode-adapter/issues/104. It is a problem for macOS and Linux distros.

JustinGrote commented 1 year ago

104 was fixed so I'm going to assume this is now fixed too, if you are still having a problem let me know and I'll reopen the issue.