justafish / ddev-drupal-core-dev

ddev addon for core development
Apache License 2.0
24 stars 10 forks source link

phpunit not working in ddev on Mac #39

Closed finnlewis closed 3 weeks ago

finnlewis commented 3 months ago

Hey folks, this is great!

It works a treat on my Ubuntu machine, following the steps fro the README.md.

However, on my Mac, phpunit does not seem to be working.

When attempting to run phpunit, I get the following:

finn$ ddev phpunit core/modules/sdc
Clearing old webdriver sessions
PHPUnit 10.5.26 by Sebastian Bergmann and contributors.

Unknown option "--verbose"
Failed to run phpunit core/modules/sdc: exit status 2

I'm using ddev version v1.23.3 on both machines.

I followed the same steps, copied below:

git clone https://git.drupalcode.org/project/drupal.git drupal
cd drupal
ddev config --omit-containers=db --disable-settings-management
ddev start
ddev get justafish/ddev-drupal-core-dev
ddev restart
ddev composer install

# See included commands
ddev drupal list

# Install drupal
ddev drupal install

# Run PHPUnit tests
ddev phpunit core/modules/sdc

# Run Nightwatch tests (currently only runs on Chrome)
ddev nightwatch --tag core

Any ideas?

rfay commented 3 months ago

phpunit v10 does not have the --verbose option.

This project's phpunit command does not use the --verbose option, see https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit

Why don't you rm -rf .ddev/commands/web/phpunit ~/.ddev/commands/web/phpunit and do the ddev get again and ddev restart and see if you make any progress. Also try ddev exec phpunit, which is mostly the same thing. I think you may have a script in your project that is using --verbose

finnlewis commented 3 months ago

Hey @rfay

Thanks for the quick reply.

Looks like it's in the latest tagged release: https://github.com/justafish/ddev-drupal-core-dev/blob/v0.0.11/commands/web/phpunit#L10

But not on https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit#L14

Does the ddev get justafish/ddev-drupal-core-dev pull in the latest tagged release or main branch ?

finnlewis commented 3 months ago

Yeah, replacing my .ddev/commands/web/phpunit with this one seems to play better!

https://github.com/justafish/ddev-drupal-core-dev/blob/main/commands/web/phpunit

:)

finnlewis commented 3 months ago

If we tag another release would that fix it?

rfay commented 3 months ago

I see, this was fixed in https://github.com/justafish/ddev-drupal-core-dev/commit/cd06f6cea7781286c769dc4129ed672bb29c316f

That was pulled on May 23, 2024, and @justafish hasn't made a release since then.

You can get latest with ddev get https://github.com/justafish/ddev-drupal-core-dev/tarball/main

@justafish how about a release? (Or give privs to an additional person?)

finnlewis commented 3 months ago

Fab, thanks @rfay

Updated install / startup steps that work for me:

git clone https://git.drupalcode.org/project/drupal.git drupal
cd drupal
ddev config --omit-containers=db --disable-settings-management
ddev start
ddev get https://github.com/justafish/ddev-drupal-core-dev/tarball/main
ddev restart
ddev composer install

# See included commands
ddev drupal list

# Install drupal
ddev drupal install

# Run PHPUnit tests
ddev phpunit core/modules/text

# Run Nightwatch tests (currently only runs on Chrome)
ddev nightwatch --tag core

Note: ddev phpunit core/modules/sdc did not run any tests for me, as it looks like there are no tests there to run as it's been moved to core, so maybe a different example would be useful to demonstrate the tests running, like ddev phpunit core/modules/text

Anyway, all good, happy to close this.

Thanks for your help @rfay , you are a legend!

rfay commented 3 months ago

I guess we should leave it open until release happens. Maybe you can close it then.

scottatdrake commented 3 weeks ago

Just wanted to report that I ran into this issue but the comments here got me up and running. Thanks for that. Maybe a new tag as requested in #40 would make things easier for the next folks to come by.

justafish commented 3 weeks ago

done :+1: