-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
🎨 test: include expected result in error messages #16039
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
Conversation
The script being tested for is expected to be present only if the analytics id is provided. To improve user experience, the error message indicates whether the script is expected to be present or not.
test/doctool/test-doctool-html.js Outdated
| assert(actual.includes('google-analytics.com'), | ||
| 'Google Analytics script was not present'); | ||
| assert(actual.includes(scriptDomain), | ||
| 'Google Analytics script was not present, but it should be'); |
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.
The idea here is to include the actual value and not only to change the message.
So it should actually be like
assert(actual.includes(scriptDomain), `Google Analytics script was not present in "${actual}"`);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.
@chowdhurian could you push a commit to this branch that makes the change @BridgeAR suggested? LGTM with those changes.
Remove expected result from error message and include actual result for clarity and easier debugging.
| Linter failed not ok 30 - /usr/home/iojs/build/workspace/node-test-linter/test/doctool/test-doctool-html.js --- message: Missing semicolon. severity: error data: line: 118 column: 54 ruleId: semi messages: - message: Line 130 exceeds the maximum line length of 80. severity: error data: line: 130 column: 1 ruleId: max-len ... |
Linter errored for missing semi colon and line length.
| Rerun linter: https://ci.nodejs.org/job/node-test-linter/12334/ ✔️ |
| Landed in 6a9fd06 Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 ! |
PR-URL: #16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs/node#16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #16039 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The script being tested for is expected to be present only if the analytics id is provided. To improve user experience, the error message indicates whether the script is expected to be present or not.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test