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

Cannot read property 'file' of undefined #18

Closed
borekb opened this issue May 17, 2019 · 5 comments
Closed

Cannot read property 'file' of undefined #18

borekb opened this issue May 17, 2019 · 5 comments

Comments

@borekb
Copy link

borekb commented May 17, 2019

My problem probably is that this extension cannot find the PHPUnit binary (my tests live in a subfolder of a workspace, so the vendor folder is not at the top level) but the error given is rather mysterious:

(node:25214) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'file' of undefined
    at e.Controller.<anonymous> (/Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:76244)
    at Generator.next (<anonymous>)
    at /Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:74403
    at new Promise (<anonymous>)
    at s (/Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:74180)
    at e.Controller.runFile (/Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:76116)
    at e.Controller.<anonymous> (/Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:75847)
    at Generator.next (<anonymous>)
    at /Users/borekb/.vscode/extensions/recca0120.vscode-phpunit-2.0.41/server/out/server.js:1:74403
    at new Promise (<anonymous>)
(node:25214) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

I've also seen a similar error with EACCES which I cannot reproduce now.

It would be nice if a more useful message was printed.

@borekb
Copy link
Author

borekb commented May 17, 2019

Everything works beautifully if I open subfolder in a separate VSCode instance. However, having our workspace root open and trying to put something like this to .vscode/settings.json doesn't work:

{
  "phpunit.phpunit": "${workspaceFolder}/subfolder/vendor/bin/phpunit",
  "phpunit.args": [
    "--configuration ./subfolder/tests/phpunit.xml"
  ],
}

@recca0120
Copy link
Owner

OK. I'll fix this problem at next version ...

@opus-2
Copy link

opus-2 commented May 17, 2019

@borekb meanwhile, it might help to set your environment PATH variable to your phpunit bin folder, have you tried it?

@recca0120
Copy link
Owner

recca0120 commented May 19, 2019

Try latest version

@borekb
Copy link
Author

borekb commented May 19, 2019

Thanks, it detects my tests now without any further configuration.

There's one problem though – it also scans gitignored folders, for example, I get tons of tests from the subfolder/vendor directory.

UPDATE: created a separate issue for it: #20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants