Wulfheart / pretty-routes

Display your Laravel routes in the console, but make it pretty. 😎

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

-d --update-snapshots flag is needed for the phpunit tests to work

bhushan opened this issue · comments

Screenshot 2021-04-30 at 1 52 17 AM

If a new contributor forks the project and runs the tests .. then it fails .. and it suggests adding -d --update-snapshots flag with the PHP unit command.. then tests works fine.

but the problem is snapshots output file is modified and then it will be part of new PR. SO each new PR will have its own snapshot version.

commented

Did you fork the current master? @Gummibeer added in #12 an additiona env variable for this.

yes just before some time. I thought of working on that filter route feature.. but faced this.

commented

Try merging the current master branch. This should(!) do the trick,

Screenshot 2021-04-30 at 2 11 59 AM

took pull again

commented

So this can be closed now?

No, What I meant was I took pull again .. even forked it again.. still facing the same thing

commented

Oh. Not good. @Gummibeer any idea?

I'm unable to reproduce - I've tried it with different terminals on different machines and resized them a lot, all tests passed every time.
@bhushan you've pulled from your own master branch. Could you pull from the base master branch?

git pull https://github.com/Wulfheart/pretty-routes.git master

Actually, I forked it again by deleting the previous fork.. so it should have the latest changes. Still checking it once again for surity.

Screenshot 2021-04-30 at 3 42 57 PM

I still see the problem @Gummibeer

But only one test - could it be that different terminals use different ansi codes. 🤔
It's not the width failing now - or at least it doesn't seem like as the base output test passes.
Could you comment what your updated snapshot would look like?

I dont think so terminals has different ansi codes but still JFI I have macbook pro ratina display, i use iterm with zsh, (oh my zsh).

in the screenshots. That is phpstorm terminal..

its 16inch display .. may be you get terminal width idea from this

It's different ansi codes (or however they are named).
current snapshot [34m
@bhushan snapshot [38;2;108;114;128m

diff --git a/tests/__snapshots__/SnapshotTest__ansi_output__1.txt b/tests/__snapshots__/SnapshotTest__ansi_output__1.txt
index 1af285a..3d21f3b 100644
--- a/tests/__snapshots__/SnapshotTest__ansi_output__1.txt
+++ b/tests/__snapshots__/SnapshotTest__ansi_output__1.txt
@@ -1,11 +1,11 @@
-  �[32mGET�[39m�[37;1m|�[39;22m�[39mHEAD�[39m       �[37;1m/�[39;22m�[34m .......................................................................................... �[39m
+  �[32mGET�[39m�[37;1m|�[39;22m�[39mHEAD�[39m       �[37;1m/�[39;22m�[38;2;108;114;128m .......................................................................................... �[39m

So seems like testing the ansi formatting with snapshot tests is a bad idea. Instead it should test what is thrown into the symfony output formatter. So like <fg=red> - this is always the same.

Output formatter seems nice idea ..

commented

The tests are currently still failing in Github Actions and I have still no idea why. Therefore I tested it manually on my machine.

Anyone working on this issue? I will be having busy schedule this week.. If it doesn't gets fixed till then then i will share PRs on Saturday may be.

@Gummibeer Tom are you on to it ?

Nope, I'm not on it.

@mattstauffer @Gummibeer How can i get output formatter in tests?

Can you use the artisan expects?

https://www.csrhymes.com/2021/01/31/testing-a-laravel-console-command.html

I don't know if that works in a package.

commented

Closing as the Laravel 9 will support the command natively as per this PR.