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

Vscode PyTest - TypeError: Cannot read property '$' of undefined #243

Closed
2 tasks done
mr-narender opened this issue Aug 16, 2019 · 7 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@mr-narender
Copy link

mr-narender commented Aug 16, 2019

Describe the bug
while trying to configure and run a PyTest via vscodium, I struck across the following error.

TypeError: Cannot read property '$' of undefined

While it seems the test case ran nicely, however, the final output has a specific error message as shown above.

Please confirm that this problem is VSCodium-specific

  • This bug does happen if I use Microsoft's Visual Studio Code.

Please confirm that the issue/resolution isn't already documented

To Reproduce
Steps to reproduce the behavior:

  1. Create a test suite in python (I choose pytest)
  2. Run Python: Discover Tests and choose test directory appropriately and then run them.
  3. Scroll down to output message at the bottom and notice the error
  4. See error message which says TypeError: Cannot read property '$' of undefined

Expected behavior
Notice the error message which says TypeError: Cannot read property '$' of undefined

Screenshots
Screenshot 2019-08-16 at 12 43 44 PM

Desktop (please complete the following information):

  • Architecture x86_64
  • Version: 1.37.0
  • Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
  • Date: 2019-08-09T18:17:16.536Z
  • Electron: 4.2.7
  • Chrome: 69.0.3497.128
  • Node.js: 10.11.0
  • V8: 6.9.427.31-electron.0
  • OS: Darwin x64 18.7.0

Additional context
Log Messages on Toggle Developer Tools Console

[Extension Host] Info Python Extension: 2019-08-16 12:25:38: Cached data exists getEnvironmentVariables, extension-output-#4
console.ts:137 [Extension Host] Info Python Extension: 2019-08-16 12:25:40: Cached data exists getEnvironmentVariables, /Users/narender/Documents/workspace/pageFreezer
console.ts:137 [Extension Host] Info Python Extension: 2019-08-16 12:25:41: Cached data exists ActivatedEnvironmentVariables, /Users/narender/Documents/workspace/pageFreezer
console.ts:137 [Extension Host] Info Python Extension: 2019-08-16 12:25:41: getActivatedEnvironmentVariables, Class name = b, completed in 2ms, Arg 1: <Uri:/Users/narender/Documents/workspace/pageFreezer>, Arg 2: undefined, Arg 3: undefined
console.ts:137 [Extension Host] Info Python Extension: 2019-08-16 12:25:41: > ~/.virtualenvs/pagefreezer/bin/python -m pytest --junitxml=/var/folders/c5/13stthys6vsbpy0cx4nqn5780000gn/T/tmp-19867qKAllU9iOzps.xml tests
console.ts:137 [Extension Host] Info Python Extension: 2019-08-16 12:25:41: cwd: ~/Documents/workspace/pageFreezer
notificationsAlerts.ts:40 There was an error in running the tests.
onDidNotificationChange @ notificationsAlerts.ts:40
_register.model.onDidNotificationChange.e @ notificationsAlerts.ts:26
fire @ event.ts:572
addNotification @ notifications.ts:156
notify @ notificationService.ts:55
r @ mainThreadMessageService.ts:83
_showMessage @ mainThreadMessageService.ts:44
$showMessage @ mainThreadMessageService.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:572
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:572
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:572
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:137 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot read property '$' of undefined
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:572
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:572
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:572
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:137 [Extension Host] stack trace: TypeError: Cannot read property '$' of undefined   at module.exports.i.readFile.n.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/extension.js:75:948003) at l.<anonymous> (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:50429)   at l.emit (events.js:182:13)    at i.onclosetag (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:49765)    at I (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2:6036)    at A (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2:6075)    at M (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2:9359)    at i.write (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:58596) at l.module.exports.904.e.Parser.l.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:50669) at l.module.exports.904.h [as parseString] (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:45293) at Object.module.exports.904.e.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1:51007) at module.exports.i.readFile (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/extension.js:75:947919)   at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:572
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:572
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:572
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
mainThreadExtensionService.ts:64 [[object Object]]Cannot read property '$' of undefined
$onExtensionRuntimeError @ mainThreadExtensionService.ts:64
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:572
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:572
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:572
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
mainThreadExtensionService.ts:65 TypeError: Cannot read property '$' of undefined
    at module.exports.i.readFile.n.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/extension.js:75)
    at l.<anonymous> (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at l.emit (events.js:182)
    at i.onclosetag (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at I (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2)
    at A (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2)
    at M (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:2)
    at i.write (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at l.module.exports.904.e.Parser.l.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at l.module.exports.904.h [as parseString] (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at Object.module.exports.904.e.parseString (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/node_modules/xml2js.js:1)
    at module.exports.i.readFile (/Users/narender/.vscode-oss/extensions/ms-python.python-2019.8.30787/out/client/extension.js:75)
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53)
@mr-narender mr-narender added the bug Something isn't working label Aug 16, 2019
@cornel-masson
Copy link

Just happened to me as well. It was working fine previously, I then did a git rebase which included changing dev dependencies in Pipfile (pipenv). After the pipenv install --dev, I restarted vscode and this error starting showing up when running my tests (pytest).

Version: 1.37.1 (system setup)
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:17:55.855Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763

@adjl
Copy link

adjl commented Aug 16, 2019

Just happened to me too.

Version: 1.37.0
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
OS: Linux Mint 18.3 x64

@directcsd
Copy link

Same issue here. It seems it is the python extension:

[2019-08-17 09:14:37.534] [renderer1] [error] Cannot read property '$' of undefined: TypeError: Cannot read property '$' of undefined at module.exports.i.readFile.n.parseString (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\extension.js:75:948003) at l.<anonymous> (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:50429) at l.emit (events.js:182:13) at l.EventEmitter.emit (domain.js:442:20) at i.onclosetag (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:49765) at I (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:6036) at A (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:6075) at M (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:9359) at i.write (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:58596) at l.module.exports.904.e.Parser.l.parseString (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:50669) at l.module.exports.904.h [as parseString] (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:45293) at Object.module.exports.904.e.parseString (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:51007) at module.exports.i.readFile (C:\Users\mmanta\.vscode\extensions\ms-python.python-2019.8.30787\out\client\extension.js:75:947919) at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

@asherf
Copy link

asherf commented Aug 18, 2019

microsoft/vscode-python#6990

@cornel-masson
Copy link

@asherf: Thanks, downgrading pytest to 5.0.1 does the trick. I guess we can close this one?

@domoritz
Copy link

Shouldn't this plugin work with the latest version of pytest?

@stripedpajamas
Copy link
Member

The plug-in should work with the latest version of pytest, and that can be solved in the plug-in repo.

Closing this as there is no issue with VSCodium here.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants