-
Notifications
You must be signed in to change notification settings - Fork 31
Added stacktraces to test runner output #519
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
base: primary
Are you sure you want to change the base?
Added stacktraces to test runner output #519
Conversation
Vighnesh-V
left a comment
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.
Thanks! This is really nice to have - can you add a test like I suggested as well as look into if it's possible to trim the full stacktrace on display?
| error: string, -- the error message from the assertion | ||
| filename: string, -- source file where the failure occurred | ||
| linenumber: number, -- line number of the failure | ||
| stacktrace: string, -- full stacktrace at the point of failure |
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.
If you look at tests/cli/test/test.test.luau (sorry for horrific naming lol), can you add a test for this? Moreover is it possible to trim the stacktrace? E.g. show the last 5 frames before the crash?
Most popular test runners have a way to pass configuration to the unit test runner for things like stacktrace verbosity in CI vs during development. We don't have that today, and forcing engs to use "only truncated" in the meantime seems too restrictive, so I think it would be best to align on how we want configuration for test.luau to work first. |
|
@Gravemind1142 That's reasonable - we can include the full stacktrace for now and include the verbosity as a toggle in |
| print(`❌ {failed.test}`) | ||
| print(` {failed.filename}:{failed.linenumber}`) | ||
| print(` {failed.assertion}: {failed.error}`) | ||
| if failed.stacktrace and failed.stacktrace ~= "" then |
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.
| if failed.stacktrace and failed.stacktrace ~= "" then | |
| if failed.stacktrace ~= "" then |
if the stacktrace is always present and just empty string when not set, we don't need to check if it's present
This PR updates the test runner to include stack traces in the output for failed tests. This will make it easier to debug both the tests and the source code.