-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Nest test results under describe scopes #12189
base: main
Are you sure you want to change the base?
Conversation
@jakeboone02 This is so nice! Great job! One thing that I noticed while looking this over was the "new" example shows as being over 6x slower than before. Is that repeatable/consistent? |
Thanks! I think the speed difference is just because the new one is a debug build. I'll try a release build later tonight. |
❌ @jakeboone02, your commit has failing tests :( 💪 1 failing tests Darwin AARCH64
🪟💻 1 failing tests Windows x64 baseline
|
@mangs I tried the release build from this PR with
@Jarred-Sumner I have a feeling this speed difference is insignificant and/or inconsistent, but I'd love to know if I accidentally made it faster somehow. EDIT: after some more benchmarking, it does appear to have made very little perf impact, if any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added commit c2c667a that better aligns the message for when a .todo
test passes and the --todo
flag has been set. I didn't really know what I was doing so I copied similar code from here:
Lines 113 to 122 in d356e27
fn printTestLine(label: string, elapsed_ns: u64, parent: ?*jest.DescribeScope, comptime skip: bool, writer: anytype) void { | |
var scopes_stack = std.BoundedArray(*jest.DescribeScope, 64).init(0) catch unreachable; | |
var parent_ = parent; | |
while (parent_) |scope| { | |
scopes_stack.append(scope) catch break; | |
parent_ = scope.parent; | |
} | |
const scopes: []*jest.DescribeScope = scopes_stack.slice(); |
That seems like a lot of code just to get the number of items in a linked list, so please let me know if there's a more efficient way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had the same thought. Needs statusing at the file level, too. I think Other than that, is this ready after I commit that suggestion about the |
Yeah, we will probably need to store the results and print either after a describe scope finishes or maybe after the file finishes.
Yep I'd say it's good to go after that |
What does this PR do?
Updates the output of
bun test
so thatdescribe
scope names are only printed once andtest
/it
results are nested and indented beneath their respective scopes.Fixes Nest
test
/it
calls under a singledescribe
label instead of repeating thedescribe
label for each test #3342Documentation or TypeScript types
Code changes
How did you verify your code works?
There were no existing automated tests for the output format, so manual inspection has been the only test so far. I can write some tests if necessary.
bun-debug test test-file-name.test
)Comparison of results