Pest 3.5 Jenkins pipeline with Docker fails with pest()->extend() error #1306
Unanswered
TPohjalainen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have weird problem on my hands. I use Jenkins Pipelines with docker and my pest test fails with pest()->extend() error. My real project is laravel 10, pest 2.34 that was migrated to 11 and 3.50 and now it fails. The real project, before migration run normally.
To reproduce in a smaller project, I made a new laravel 11 project, without a starter kit, with pest 3.5.0 and sqlite and tried to run the template ExampleTest.php and it fails like my real project does.
I get a "Call to undefined method Home\jenkins\workspace\pestbug\tests\Feature\ExampleTest::get(). Did you forget to use the [pest()->extend()] function?" error in my tests.
I have the pest()->extend(Tests\TestCase::class)->use(Illuminate\Foundation\Testing\RefreshDatabase::class)->in('Feature','Unit');
in my Pest.php file. If I move that line without the in() to the top of my ExampleTest.php, then this test will succeed.
I have ran out of ideas on what could be the issue here. Running test locally works, running test inside the image made by Jenkins works, but running test in Jenkins fails.
If anyone has any ideas, any help would be much appreciated. Only thing I'm thinking on that it might have something to do with the test directories, because the fail message uses \Home\jenkins\workspace which is not the working dir inside the docker. That is the real directory on the docker host. I must say, that I'm not very good with jenkins and docker, so there might be some conf I'm missing.
Thanks.
My Pest.php file:
My Dockerfile:
My Jenkinsfile:
My phpunit.xml:
My ExampleTest.php:
On .env files I just added sqlite with :memory: database.
Beta Was this translation helpful? Give feedback.
All reactions