Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(printResult): tables included colors even when outputStream did not support it #513

Merged
merged 4 commits into from Mar 18, 2024

Conversation

10xLaCroixDrinker
Copy link
Contributor

Fixes one of the two bugs described in #474

Before

$ node autocannon.js http://google.com/ --verbose > output.txt 2>&1

Running 10s test @ http://google.com/
10 connections


^[[90m┌─────────^[[39m^[[90m┬──────^[[39m^[[90m┬──────^[[39m^[[90m┬───────^[[39m^[[90m┬──────^[[39m^[[90m┬──────^[[39m^[[90m┬───────^[[39m^[[90m┬──────┐^[[39m
^[[90m│^[[39m^[[31m Stat    ^[[39m^[[90m│^[[39m^[[31m 2.5% ^[[39m^[[90m│^[[39m^[[31m 50%  ^[[39m^[[90m│^[[39m^[[31m 97.5% ^[[39m^[[90m│^[[39m^[[31m 99%  ^[[39m^[[90m│^[[39m^[[31m Avg  ^[[39m^[[90m│^[[39m^[[31m Stdev ^[[39m^[[90m│^[[39m^[[31m Max  ^[[39m^[[90m│^[[39m
^[[90m├─────────^[[39m^[[90m┼──────^[[39m^[[90m┼──────^[[39m^[[90m┼───────^[[39m^[[90m┼──────^[[39m^[[90m┼──────^[[39m^[[90m┼───────^[[39m^[[90m┼──────┤^[[39m
^[[90m│^[[39m Latency ^[[90m│^[[39m 0 ms ^[[90m│^[[39m 0 ms ^[[90m│^[[39m 0 ms  ^[[90m│^[[39m 0 ms ^[[90m│^[[39m 0 ms ^[[90m│^[[39m 0 ms  ^[[90m│^[[39m 0 ms ^[[90m│^[[39m
^[[90m└─────────^[[39m^[[90m┴──────^[[39m^[[90m┴──────^[[39m^[[90m┴───────^[[39m^[[90m┴──────^[[39m^[[90m┴──────^[[39m^[[90m┴───────^[[39m^[[90m┴──────┘^[[39m
^[[90m┌───────────^[[39m^[[90m┬─────^[[39m^[[90m┬──────^[[39m^[[90m┬─────^[[39m^[[90m┬───────^[[39m^[[90m┬─────^[[39m^[[90m┬───────^[[39m^[[90m┬─────┐^[[39m
^[[90m│^[[39m^[[31m Stat      ^[[39m^[[90m│^[[39m^[[31m 1%  ^[[39m^[[90m│^[[39m^[[31m 2.5% ^[[39m^[[90m│^[[39m^[[31m 50% ^[[39m^[[90m│^[[39m^[[31m 97.5% ^[[39m^[[90m│^[[39m^[[31m Avg ^[[39m^[[90m│^[[39m^[[31m Stdev ^[[39m^[[90m│^[[39m^[[31m Min ^[[39m^[[90m│^[[39m
^[[90m├───────────^[[39m^[[90m┼─────^[[39m^[[90m┼──────^[[39m^[[90m┼─────^[[39m^[[90m┼───────^[[39m^[[90m┼─────^[[39m^[[90m┼───────^[[39m^[[90m┼─────┤^[[39m
^[[90m│^[[39m Req/Sec   ^[[90m│^[[39m 0   ^[[90m│^[[39m 0    ^[[90m│^[[39m 0   ^[[90m│^[[39m 0     ^[[90m│^[[39m 0   ^[[90m│^[[39m 0     ^[[90m│^[[39m 0   ^[[90m│^[[39m
^[[90m├───────────^[[39m^[[90m┼─────^[[39m^[[90m┼──────^[[39m^[[90m┼─────^[[39m^[[90m┼───────^[[39m^[[90m┼─────^[[39m^[[90m┼───────^[[39m^[[90m┼─────┤^[[39m
^[[90m│^[[39m Bytes/Sec ^[[90m│^[[39m 0 B ^[[90m│^[[39m 0 B  ^[[90m│^[[39m 0 B ^[[90m│^[[39m 0 B   ^[[90m│^[[39m 0 B ^[[90m│^[[39m 0 B   ^[[90m│^[[39m 0 B ^[[90m│^[[39m
^[[90m└───────────^[[39m^[[90m┴─────^[[39m^[[90m┴──────^[[39m^[[90m┴─────^[[39m^[[90m┴───────^[[39m^[[90m┴─────^[[39m^[[90m┴───────^[[39m^[[90m┴─────┘^[[39m

Req/Bytes counts sampled once per second.
# of samples: 10

20 requests in 10.02s, 0 B read
10 errors (10 timeouts)

After

$ node autocannon.js http://google.com/ --verbose > output.txt 2>&1

Running 10s test @ http://google.com/
10 connections


┌─────────┬──────┬──────┬───────┬──────┬──────┬───────┬──────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg  │ Stdev │ Max  │
├─────────┼──────┼──────┼───────┼──────┼──────┼───────┼──────┤
│ Latency │ 0 ms │ 0 ms │ 0 ms  │ 0 ms │ 0 ms │ 0 ms  │ 0 ms │
└─────────┴──────┴──────┴───────┴──────┴──────┴───────┴──────┘
┌───────────┬─────┬──────┬─────┬───────┬─────┬───────┬─────┐
│ Stat      │ 1%  │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤
│ Req/Sec   │ 0   │ 0    │ 0   │ 0     │ 0   │ 0     │ 0   │
├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤
│ Bytes/Sec │ 0 B │ 0 B  │ 0 B │ 0 B   │ 0 B │ 0 B   │ 0 B │
└───────────┴─────┴──────┴─────┴───────┴─────┴───────┴─────┘

Req/Bytes counts sampled once per second.
# of samples: 10

20 requests in 10.03s, 0 B read
10 errors (10 timeouts)

Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Owner

CI is failing

@10xLaCroixDrinker
Copy link
Contributor Author

@mcollina CI is resolved

@mcollina mcollina merged commit cb1fe35 into mcollina:master Mar 18, 2024
13 of 14 checks passed
@10xLaCroixDrinker 10xLaCroixDrinker deleted the bugfix/colorsafe-tables branch March 18, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants