mfridman / tparse

CLI tool for summarizing go test output. Pipe friendly. CI/CD friendly.
MIT License
948 stars 22 forks source link

Misaligned output in GitHub action output #85

Closed moduli closed 1 year ago

moduli commented 1 year ago

When using tparse in a GitHub action, I'm finding the table summary output to be misaligned. I'm not sure if it has something to do with the length of my package name. The formatting looks like fine when running locally.

-format basic

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  STATUS │ ELAPSED │                             PACKAGE
│ COVER │ PASS │ FAIL │ SKIP  │
│─────────┼─────────┼─────────────────────────────────────────────────────────────────┼───────┼──────┼──────┼───────│
│  FAIL   │ 455.07s │
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │ 0.0%  │
17 │    1 │    0  │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

-format plain

STATUS  ELAPSED                              PACKAGE                              COVER  PASS  FAIL  SKIP  
FAIL    353.12s  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  0.0%     17     1     0  

-format markdown

| STATUS | ELAPSED |                             PACKAGE
| COVER | PASS | FAIL | SKIP |
|--------|---------|-----------------------------------------------------------------|-------|------|------|------|
| FAIL   | 458.84s |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | 0.0%  |
17 |    1 |    0 |
mfridman commented 1 year ago

Thanks for the report, indeed this can happen if the package name is long. We can likely improve the experience here.

Afaics there are 2 descent options:

E.g., -trimpath=github.com/mfridman/tparse would convert this:

┌──────────────────────────────────────────────────────...
│  STATUS │ ELAPSED │             PACKAGE              ...
│─────────┼─────────┼──────────────────────────────────...
│  PASS   │  0.12s  │ github.com/mfridman/tparse/parse ...
│  PASS   │  0.61s  │ github.com/mfridman/tparse/tests ...
└──────────────────────────────────────────────────────...

to this:


┌──────────────────────────────....
│  STATUS │ ELAPSED │ PACKAGE              
│─────────┼─────────┼──────────....
│  PASS   │  0.12s  │ parse 
│  PASS   │  0.61s  │ tests 
└──────────────────────────────....
moduli commented 1 year ago

It's weird that it seems to be formatted fine when I run locally. It's possible there's something else going on. I am invoking go test | tparse through another tool, so it's possible that tool is messing with the formatting in some way. I think I'm going to close this and investigate further (unless you know for sure that the long package name can sometimes cause this behavior?)

mfridman commented 1 year ago

Thanks for the report. Going to close this for now, but if you continue to see issues please comment below or file a new issue.