Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GodziLaravel's avatar

ERROR Command "test" is not defined.

Hello

With the support of chat GPT I created this .gitlab-ci.yml file

when I run the pipelines the stages setup and build successed but I got an error on test stage :

$ php artisan migrate --force
   INFO  Preparing database.  
  Creating migration table ......................................... 25ms DONE
   INFO  Running migrations.  
  2014_10_12_000000_create_users_table ............................. 17ms DONE
(...)
  2024_02_14_202021_remove_columns_from_stops_table ................. 2ms DONE
$ php artisan test
   ERROR  Command "test" is not defined. Did you mean one of these?  
  ⇂ make:test  
  ⇂ schedule:test  
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

I’m not sure how to resolve this issue! On my local setup, I use Laravel Sail, and the unit tests run successfully with the command sail test. Do you have any suggestions?

0 likes
4 replies
Nakov's avatar
Nakov
Best Answer
Level 73

I think the reason is because you are running composer with the --no-dev flag. So just remove that, and the test command should be available.

1 like

Please or to participate in this conversation.