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

Feature request: Test Directory for 2 and 3 levels up #89

Closed
BladeMF opened this issue Nov 28, 2023 · 7 comments
Closed

Feature request: Test Directory for 2 and 3 levels up #89

BladeMF opened this issue Nov 28, 2023 · 7 comments
Assignees

Comments

@BladeMF
Copy link
Contributor

BladeMF commented Nov 28, 2023

Hi, since you've been away I've forked the extension to fix my two suggestions and I added two additional commands - "Test Directory [2]" and "Test Directory [3]" which work the same way as "Test Directory", but respectively 2 and 3 levels up from the current file.

I could PR them if you're okay with this or you can do them yourself, but they are really useful since I usually have a pretty deep directory structure for tests - if a class has more tests I tend to split them into separate files and put them in a folder with the name of the class. And so if I want to run all the tests from the class' namespace, I need a filter that is 2 directories up, not one.

I hope that this makes sense.

@elonmallin
Copy link
Owner

Hi, yes that makes sense. Please make a PR and also add a test for it, would be great :)

I've refactored quite a bit and added some tests so should be possible to add tests for that as well but you'll need to update the expected count of some current tests probably.

You need php and composer on your path then you can run the tests with npm run test.

CI will also run tests when you create a PR.

@BladeMF
Copy link
Contributor Author

BladeMF commented Nov 29, 2023

Thanks!
A bunch of quesitons for the development environment:

  1. Do you use a specific Docker image to develop this?
  2. Is there anything specific about the PHP I need? What is used for?
  3. So I need npm, typescript, anything else?

@elonmallin
Copy link
Owner

The prereqs do develop locally should just be:

  • node lts
  • php latest
  • composer latest

I dont use a Docker locally I just have the above installed.

npm i and npm run test should work when you have the above installed I hope.

You should also be able to debug the extension with F5. There's also a launch setting to debug the tests.

Let me know if you run into problems, Im just listing what I believe is needed.

@elonmallin
Copy link
Owner

I added a contribute section to the readme.

Also added Open in Dev Containers (haven't really worked it much myself though)

@BladeMF
Copy link
Contributor Author

BladeMF commented Dec 3, 2023

So, in a Docker container it is a pain in the ass so I falled back to Windows. There seems to be a problem with the Docker driver deciding it should run in a docker container though, I had to disable it to run tests.

@elonmallin
Copy link
Owner

Thanks! I merged your PR and pushed a new version on the way out now.

Ok too bad the devcontainer didn't work for you, I tried it the day after on another PC and it worked for me. Since inside the devcontainer it has php on the path it should pick that driver and not the docker driver. I could debug as well. Basically just click the button and F5. Guess "works on my machine" didn't go away with docker after all.

@BladeMF
Copy link
Contributor Author

BladeMF commented Dec 3, 2023

Nothing to worry about. Thank you!

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

No branches or pull requests

2 participants