Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: transform file paths into hyperlinks #8980
feat: transform file paths into hyperlinks #8980
Changes from 5 commits
1cd4955
243a697
00ac96c
da3d6a7
8d638f0
350e8ea
bd09213
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Would prefer if we hardcode the expected call argument values here without using
formatTestPath
/testResult
, it kinda reimplements the production code this way and is not easy on the eye.Also I think
toHaveBeenCalledWith
simplifies this a lot (4 lines to 1)?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've tried hardcoding the
formatTestPath
result by copy-pasting it from the console, but it contains the parts which are coloured by the chalk library and it seems to get lost when copied, any idea how could I keep it if we still want to go hardcode it?btw. is reimplementing the production code in tests a bad practice? if so, what's exactly wrong with it?
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.
Could mock chalk like some other tests do so it just becomes something like
<green>text</green>
. But that's probably too complicated. Maybe justexpect.stringContaining('the test path')
?What I mean re reimplementing: The reason we write tests is to run the code with specific example data that reproduces a case simple enough to wrap our heads around. If we could manage the complexity of all cases in all the code at once, we wouldn't need tests but could just look at the production code and see whether it's correct ;)
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.
That makes sense, thanks for the explanation @jeysal ! I've hardcoded the expected values, let me know if that's what you had in mind :)