-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
tests(smoke): add tests for report-assert.js #14138
Conversation
This is another instance of an old discussion, but the report assertions are simple and compose simply and so would lend themselves to regular unit tests very well: (1) Do these assertions work, then (2) Do these assertions compose. Snapshot tests can be good for complicated data and especially for complicated data that's expected to change often, but they come at the price of being verbose and having a low signal/noise ratio. It's difficult to tell what a test is for (especially when it fails on something that it's ostensibly not for), and there's a ton of input and a ton of output to wade through to figure that out. The benefit of the assertions being written (relatively) generally is that an entire LHR isn't needed to test if |
|
||
describe('findDifference', () => { | ||
const testCases = { | ||
'works (trivial passing)': { |
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.
@brendankenny how's this?
return text | ||
.replace(/\x1B.*?m/g, '') | ||
.replace(/\x1b.*?m/g, '') | ||
.replace(/[✘×]/g, 'X') |
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.
any idea why logger does different characters for windows???
}, | ||
}; | ||
|
||
for (const [testName, {actual, expected, diff}] of Object.entries(testCases)) { |
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.
@exterkamp i basically wrote a go test
Adding some tests here, will help with #14128