Comments (23)
@renandelmonico created new issue since my seems to be related to config file #5
from vscode-phpunit.
now for some reason the extension is trying to call phpunit with the -c flag, trying to load a configuration from the wrong path. Solution: create an option to specify to not use the -c flag or provide the configuration path
This is the same issue as #5
from vscode-phpunit.
If you add a double non-quoted backslash ( \ ) in filepath the command works?
from vscode-phpunit.
If you add a double non-quoted backslash ( \ ) in filepath the command works?
Nope, it does not work. I tried all escapes I could think of, I don't know why it is escaping the wrong slash at all 😅
from vscode-phpunit.
If you add a double non-quoted backslash ( \ ) in filepath the command works?
Nope, it does not work. I tried all escapes I could think of, I don't know why it is escaping the wrong slash at all sweat_smile
Another test: if you change "" to "/" in "project\tests\Feature\Main\AuthTest.php" and run, it works? I think it's escaping because the docker environment is linux-based and the backslash is the escape caracter in linux. How windows uses backslack by default I think the linux container considers the backslash as escape caracter.
from vscode-phpunit.
It still does not work as intended. I will show more screenshots, showing all the configuration options as requested, the wrong outputs and the correct expected behaviour, all from WSL, invoking the docker command.
Configs
Wrong output from plugin
Wrong output from WSL because the paths are incorrect
Working in WSL after fixing paths
from vscode-phpunit.
In Linux, vscode doesn't recognize some env variables, like docker. According with your screenshots I think you should specify the full path of docker binary file. Can you test that configuration in "Docker Image" property? I don't know the filepath for docker bin in windows, but in Linux is /usr/bin/docker. If works, I'll update the README.md. In my vscode, the config is like this:
from vscode-phpunit.
In Linux, vscode doesn't recognize some env variables, like docker. According with your screenshots I think you should specify the full path of docker binary file. Can you test that configuration in "Docker Image" property? I don't know the filepath for docker bin in windows, but in Linux is /usr/bin/docker. If works, I'll update the README.md. In my vscode, the config is like this:
Docker in Windows 10 is using Docker Desktop and so the docker binary is availble directly. I tried it using both methods calling directly from Powershell. It works, but spawn
refuses to output the correct paths 🤷♂️
from vscode-phpunit.
I'm having a similar problem that might be related.
I get an output error:
spawn docker exec -it d110561 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/laravel/test123/phpunit.xml" ENOENT
I can run the following from the terminal without an issue:
docker exec -it d110561 bash -c /var/www/html/vendor/bin/phpunit
docker exec -it d110561 bash -c /var/www/html/vendor/bin/phpunit -c /var/www/html/phpunit.xml
For me, the issue seems to be the injection of the config file path:
-c /home/user13/code/laravel/test123/phpunit.xml
is my WSL project path-c /var/www/html/phpunit.xml
Vscode config:
"phpunit.relativeFilePath": true,
"phpunit.phpunit": "/var/www/html/vendor/bin/phpunit",
"phpunit.docker": true,
"phpunit.dockerImage": "docker exec -it d110561",
from vscode-phpunit.
I am not familiar with VSCode extension development so I couldn't debug it, but reading the code the issue must be how the paths are being called in line 183.
from vscode-phpunit.
What is the base image in your projects? I had a similar problem in one of my projects because de base image entrypoint is different from the php official image. What i did? I added --entrypoint="" in phpunit.dockerImage config.
PS: I don't know what the problem it yet
from vscode-phpunit.
I am using Laradock, https://laradock.io/
from vscode-phpunit.
I'm having a similar problem that might be related.
I get an output error:
spawn docker exec -it d110561 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/laravel/test123/phpunit.xml" ENOENT
I can run the following from the terminal without an issue:
docker exec -it d110561 bash -c /var/www/html/vendor/bin/phpunit docker exec -it d110561 bash -c /var/www/html/vendor/bin/phpunit -c /var/www/html/phpunit.xmlFor me, the issue seems to be the injection of the config file path:
-c /home/user13/code/laravel/test123/phpunit.xml
is my WSL project path-c /var/www/html/phpunit.xml
Vscode config:
"phpunit.relativeFilePath": true, "phpunit.phpunit": "/var/www/html/vendor/bin/phpunit", "phpunit.docker": true, "phpunit.dockerImage": "docker exec -it d110561",
Are you tried to run the command in your terminal (with double quotes)? According with you comment above I think you tried to run the command without double quotes.
docker exec -it d110561 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/laravel/test123/phpunit.xml"
from vscode-phpunit.
In Linux, vscode doesn't recognize some env variables, like docker. According with your screenshots I think you should specify the full path of docker binary file. Can you test that configuration in "Docker Image" property? I don't know the filepath for docker bin in windows, but in Linux is /usr/bin/docker. If works, I'll update the README.md. In my vscode, the config is like this:
Docker in Windows 10 is using Docker Desktop and so the docker binary is availble directly. I tried it using both methods calling directly from Powershell. It works, but
spawn
refuses to output the correct paths man_shrugging![]()
Yes, in linux the docker binary is available directly too, but in vscode environment the bash doesn't have some binary available directly so I specified the docker path manualy in my config. If you didn't try to put in your config the docker path, my sugestion is try 😆
from vscode-phpunit.
In Linux, vscode doesn't recognize some env variables, like docker. According with your screenshots I think you should specify the full path of docker binary file. Can you test that configuration in "Docker Image" property? I don't know the filepath for docker bin in windows, but in Linux is /usr/bin/docker. If works, I'll update the README.md. In my vscode, the config is like this:
Docker in Windows 10 is using Docker Desktop and so the docker binary is availble directly. I tried it using both methods calling directly from Powershell. It works, but
spawn
refuses to output the correct paths man_shrugging![]()
Yes, in linux the docker binary is available directly too, but in vscode environment the bash doesn't have some binary available directly so I specified the docker path manualy in my config. If you didn't try to put in your config the docker path, my sugestion is try 😆
now that you mention it, Docker Desktop seems to be the one making the docker command available in Windows. I can't seem to find how to call it directly. I will do some research
from vscode-phpunit.
In Linux, vscode doesn't recognize some env variables, like docker. According with your screenshots I think you should specify the full path of docker binary file. Can you test that configuration in "Docker Image" property? I don't know the filepath for docker bin in windows, but in Linux is /usr/bin/docker. If works, I'll update the README.md. In my vscode, the config is like this:
Docker in Windows 10 is using Docker Desktop and so the docker binary is availble directly. I tried it using both methods calling directly from Powershell. It works, but
spawn
refuses to output the correct paths man_shrugging![]()
Yes, in linux the docker binary is available directly too, but in vscode environment the bash doesn't have some binary available directly so I specified the docker path manualy in my config. If you didn't try to put in your config the docker path, my sugestion is try laughing
now that you mention it, Docker Desktop seems to be the one making the docker command available in Windows. I can't seem to find how to call it directly. I will do some research
Nice! Keep me informed about this, please! 😄 If have a trouble on extension I'll try to fix it when possible.
from vscode-phpunit.
As a curiosity, the absolute path to call docker from Docker Desktop on Windows is 'C:\Program Files\Docker\Docker\resources\bin\docker.exe'
😉
Anyway, I tried to simplify the variables. I now changed WSL setup to use relative Linux paths instead of the Windows mount points, and I am so close to make it work, but it is missing a couple things:
- The setup involves calling
code .
from inside WSL, to it uses the remote extension and I need to install the extension again inside WSL. It is a workaround but seems to be working fine - now for some reason the extension is trying to call phpunit with the -c flag, trying to load a configuration from the wrong path. Solution: create an option to specify to not use the -c flag or provide the configuration path
- unfortunately using the relative path option does not use the project folder. Solution: create an option to specify the project folder, so the test files can be relative correctly.
In this case, mdl
is a Laravel project. PHPUnit on Laravel is called from the \vendor
folder, but the tests are in the project itself. So you can see why the paths can't be always infered, but should be provided by the developer. The way Laradock works is providing the workspace
image, that contains the PHP executable and is aware of the relative paths.
Again, I provide the new screenshots from this approach. I think with a couple of options and strings adjustments, we can finally make it work inside WSL 🙌
Settings panel
Extension output
Adjusting the command in WSL from Windows Terminal. It works there
from vscode-phpunit.
As a curiosity, the absolute path to call docker from Docker Desktop on Windows is
'C:\Program Files\Docker\Docker\resources\bin\docker.exe'
winkAnyway, I tried to simplify the variables. I now changed WSL setup to use relative Linux paths instead of the Windows mount points, and I am so close to make it work, but it is missing a couple things:
- The setup involves calling
code .
from inside WSL, to it uses the remote extension and I need to install the extension again inside WSL. It is a workaround but seems to be working fine- now for some reason the extension is trying to call phpunit with the -c flag, trying to load a configuration from the wrong path. Solution: create an option to specify to not use the -c flag or provide the configuration path
- unfortunately using the relative path option does not use the project folder. Solution: create an option to specify the project folder, so the test files can be relative correctly.
In this case,
mdl
is a Laravel project. PHPUnit on Laravel is called from the\vendor
folder, but the tests are in the project itself. So you can see why the paths can't be always infered, but should be provided by the developer. The way Laradock works is providing theworkspace
image, that contains the PHP executable and is aware of the relative paths.Again, I provide the new screenshots from this approach. I think with a couple of options and strings adjustments, we can finally make it work inside WSL raised_hands
Settings panel
Extension output
Adjusting the command in WSL from Windows Terminal. It works there
Interesting... First of all we need check if the docker env is available in your vscode. Please, could you check if the command above works?
C:\Program Files\Docker\Docker\resources\bin\docker.exe exec -it laradock-workspace-1 blablabla
The second point is the issue #5, I think. And the last one create the config to specify the project folder. Are you agree?
from vscode-phpunit.
Interesting... First of all we need check if the docker env is available in your vscode. Please, could you check if the command above works?
C:\Program Files\Docker\Docker\resources\bin\docker.exe exec -it laradock-workspace-1 blablabla
The second point is the issue #5, I think. And the last one create the config to specify the project folder. Are you agree?
Yes, I agree
from vscode-phpunit.
Interesting... First of all we need check if the docker env is available in your vscode. Please, could you check if the command above works?
C:\Program Files\Docker\Docker\resources\bin\docker.exe exec -it laradock-workspace-1 blablablaThe second point is the issue #5, I think. And the last one create the config to specify the project folder. Are you agree?
Yes, I agree
I'll need for help from someone who run vscode with WSL because this problem looks like a specific windows bug 😢
from vscode-phpunit.
I will do more tests. Now that VScode updated as well, I will try again. I noticed I wasn't trying inside the WSL container, I was using the docker directly trying to access stuff in the Windows side. I will setup it in another way and report my findings. I use both Windows and Linux on my work, so I can test the different behaviours.
Thank you for looking on the matter so far. I will get the updated version and give another shot 🙌
from vscode-phpunit.
@renandelmonico I tried new tests. Now I am using docker inside a proper WSL container, inside VSCode. The path errors were due to execute VScode from Windows instead of WSL container. Now, the outputs of the commands are exactly the same, and it still does not work. Any ideas? 🤔
from vscode-phpunit.
Sorry for the late response. The main project has been updated. I think we should try it because there are more features. :D
from vscode-phpunit.
Related Issues (10)
- PHP server is crashing HOT 1
- phpunit.ssh setting not working HOT 1
- TypeError: Cannot read properties of undefined (reading 'loc') HOT 1
- Support ${workspaceRoot} in phpunit.phpunit setting HOT 2
- Repeated crashes of the language server HOT 3
- Using VSCode's native testing HOT 8
- plugin inject wrong config file HOT 12
- "FAILURES!" = Pass HOT 2
- Not working with Docker and differents paths HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-phpunit.