Home > Mobile >  How to capture output in a file from php artisan test?
How to capture output in a file from php artisan test?

Time:05-05

When I run php artisan test, I want to save all the output test generates in a file. I tried doing php artisan test 2> te.txt 1> to.txt. But the files are empty. What am I doing wrong?

I also tried php artisan test | tee test.txt or php artisan test > test.txt. Both of them doesn't work.

https://youtu.be/pqNfMDqwixs

CodePudding user response:

you can use this syntax to fill the file with console output

php artisan test >> test.txt

CodePudding user response:

For it to work,

you need the without-tty option :

php artisan test --without-tty > test.txt

but be aware that it will be filled with color codes, like :

[31;1m⨯[39;22m[39m [2m myTest [22m[39m

so to display it correctly you will need to cat the file

  • Related