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

plugin inject wrong config file #5

Closed
tyler36 opened this issue Apr 14, 2022 · 12 comments
Closed

plugin inject wrong config file #5

tyler36 opened this issue Apr 14, 2022 · 12 comments
Labels
bug Something isn't working question Further information is requested

Comments

@tyler36
Copy link

tyler36 commented Apr 14, 2022

I have a DDEV project I run in Remote WSL session.

If I configure this plugin to run with the following settings

    "phpunit.relativeFilePath": true,
    "phpunit.phpunit": "/var/www/html/vendor/bin/phpunit",
    "phpunit.docker": true,
    "phpunit.dockerImage": "docker exec -it 833f9",

I get the following error:

spawn docker exec -it 833f9 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/phpunit.xml" ENOENT

The following is successful

  • docker exec -it 833f9 "/var/www/html/vendor/bin/phpunit"

I do not understand why -c /home/user13/code/phpunit.xml is being injected.
This config file is my WSL path. If the command is running in docker, then it should be the dockered path?

I check the actual path:

docker exec -it 833f9 "bash"

$ find ~+ -type f -name phpunit.xml
/var/www/html/phpunit.xml

I can run the following in my terminal:

  • docker exec -it 833f9 bash -c "/var/www/html/vendor/bin/phpunit -c /var/www/html/phpunit.xml"

So I think the correct spawn command should be:

  • spawn docker exec -it 833f9 bash -c "/var/www/html/vendor/bin/phpunit -c /var/www/html/phpunit.xml"
  • spawn docker exec -it 833f9 bash -c "/var/www/html/vendor/bin/phpunit -c /home/user13/code/phpunit.xml"

VSCode 1.66.2
renandelmonico.vscode-php-test-explorer 1.0.1

@renandelmonico
Copy link
Owner

Hello! If the command is running in docker then should be used the dockered path. To avoid this problem I recomend to use the -v $(pwd):$(pwd) in the dockerImage config.

Sorry, but I didn't understand the problem. Did you mean that WSL path of phpunit.xml should be converted to the dockered path?

@renandelmonico renandelmonico added documentation Improvements or additions to documentation question Further information is requested labels Apr 14, 2022
@tyler36
Copy link
Author

tyler36 commented Apr 15, 2022

Did you mean that WSL path of phpunit.xml should be converted to the dockered path?

Yes.

This extension generates this error:

spawn docker exec -it 833f9 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/phpunit.xml" ENOENT
  1. Why is "-c /home/user13/code/phpunit.xml" added to the command?
  2. -c /home/user13/code/phpunit.xml is on WSL. It is not in docker.

@renandelmonico
Copy link
Owner

Did you mean that WSL path of phpunit.xml should be converted to the dockered path?

Yes.

This extension generates this error:

spawn docker exec -it 833f9 bash -c "var/www/html/vendor/bin/phpunit -c /home/user13/code/phpunit.xml" ENOENT
  1. Why is "-c /home/user13/code/phpunit.xml" added to the command?
  2. -c /home/user13/code/phpunit.xml is on WSL. It is not in docker.

I think it shouldn't add phpunit.xml if you didn't specify the phpunit.xml path in config file. Do you agree?

@renandelmonico renandelmonico added bug Something isn't working and removed documentation Improvements or additions to documentation labels Apr 18, 2022
@tyler36
Copy link
Author

tyler36 commented Apr 18, 2022

I think it shouldn't add phpunit.xml if you didn't specify the phpunit.xml path in config file. Do you agree?

Yes. I don't think it shoud add it.

Maybe you could add a config option. EG. "phpunit.config_file": "/home/user13/code/phpunit.xml"

  • if ! phpunit.config_file do nothing
  • if phpunit.config_file, add "-c /home/user13/code/phpunit.xml" to spawn command

@renandelmonico
Copy link
Owner

I think it shouldn't add phpunit.xml if you didn't specify the phpunit.xml path in config file. Do you agree?

Yes. I don't think it shoud add it.

Maybe you could add a config option. EG. "phpunit.config_file": "/home/user13/code/phpunit.xml"

  • if ! phpunit.config_file do nothing
  • if phpunit.config_file, add "-c /home/user13/code/phpunit.xml" to spawn command

Yes, I think it's the best way. I'll change the code soon with this bugfix.

@renandelmonico
Copy link
Owner

@tyler36 Can you test if the implementation in Pull Request #6 works? 😄 If works, I'll publish a new version with this bugfix.

@tyler36
Copy link
Author

tyler36 commented May 9, 2022

@renandelmonico

I'm not sure how to apply and test this changes.

@renandelmonico
Copy link
Owner

renandelmonico commented May 13, 2022

@renandelmonico

I'm not sure how to apply and test this changes.

I'll launch a new version (1.0.2) and if it includes new bugs, please, tell me, because I tested but I needed more person testing 😄

@tyler36
Copy link
Author

tyler36 commented May 16, 2022

Thank you for the update.

Given the following config:

    "phpunit.relativeFilePath": true,
    "phpunit.phpunit": "/var/www/html/vendor/bin/phpunit",
    "phpunit.docker": true,
    "phpunit.dockerImage": "docker exec -it e1066",

It generates the following error: spawn docker exec -it e1066 bash -c "var/www/html/vendor/bin/phpunit " ENOENT

2 things:

  • It's misisng the / at the beginning /var/www ....
  • it addes a (space) after phpunit.

docker exec -it e1066 "var/www/html/vendor/bin/phpunit " : "no such file or directory: unknown"
docker exec -it e1066 "var/www/html/vendor/bin/phpunit": "no such file or directory: unknown"
docker exec -it e1066 "/var/www/html/vendor/bin/phpunit ": "no such file or directory: unknown"
docker exec -it e1066 "/var/www/html/vendor/bin/phpunit" : works fine.

@renandelmonico
Copy link
Owner

Sorry for the late response but I'm very busy. When I'll be free I'll see these cases.

@renandelmonico
Copy link
Owner

Thank you for the update.

Given the following config:

    "phpunit.relativeFilePath": true,
    "phpunit.phpunit": "/var/www/html/vendor/bin/phpunit",
    "phpunit.docker": true,
    "phpunit.dockerImage": "docker exec -it e1066",

It generates the following error: spawn docker exec -it e1066 bash -c "var/www/html/vendor/bin/phpunit " ENOENT

2 things:

  • It's misisng the / at the beginning /var/www ....
  • it addes a (space) after phpunit.

x docker exec -it e1066 "var/www/html/vendor/bin/phpunit " : "no such file or directory: unknown" x docker exec -it e1066 "var/www/html/vendor/bin/phpunit": "no such file or directory: unknown" x docker exec -it e1066 "/var/www/html/vendor/bin/phpunit ": "no such file or directory: unknown" white_check_mark docker exec -it e1066 "/var/www/html/vendor/bin/phpunit" : works fine.

I think there're 2 points in your error:

1 - If "phpunit.relativeFilePath": true the extension will remove the / at the beginning /var/www because basically you're saying that the path is relative. i think it's not a bug.
2 - The space after phpunit is a bug! 😄

@renandelmonico
Copy link
Owner

Sorry for the late response. The main project has been updated. I think we should try it because there are more features. :D

@renandelmonico renandelmonico closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants