Refactoring: Consuming log-symbols alternate to code for win32 in reporters/base.#4389
Conversation
boneskull
left a comment
There was a problem hiding this comment.
Thanks. this looks good to me, but I think we need to consider it a breaking change, so it should wait for v9.0.0.
Can you please sign the CLA?
|
Ok, I did it :) |
|
I've re-run AppVeyor and it passed. |
|
@MoonSupport could you rebase to |
|
@juergba Done :) |
juergba
left a comment
There was a problem hiding this comment.
@MoonSupport thank you for this PR.
|
Currently looking into all the dependencies... and one of your dependencies are log-symbol log-symbols seems like a perfect package if it had just only precomputed the values instead of using chalk as an dependency import isUnicodeSupported from 'is-unicode-supported';
const main = {
info: '\x1B[34mℹ\x1B[39m',
success: '\x1B[32m✔\x1B[39m',
warning: '\x1B[33m⚠\x1B[39m',
error: '\x1B[31m✖\x1B[39m'
};
const fallback = {
info: '\x1B[34mi\x1B[39m',
success: '\x1B[32m√\x1B[39m',
warning: '\x1B[33m‼\x1B[39m',
error: '\x1B[31m×\x1B[39m'
};
const logSymbols = isUnicodeSupported() ? main : fallback;
export default logSymbols;Here is one tough: how about inlining this symbols into mocha itself? |
|
@jimmywarting thank you. The size of the code is not the only criteria. All those codes/numbers (unicode?) isn't the detail level I want to deal with. We need a package which works for different OS/browsers and is well maintained by someone else, not by Mocha. |
Description of the Change
I used the
log-symbolsinstead of the code for win32.Alternate Designs
No alternate designs
Benefits
Mocha already uses
log-symbols, so we can remove duplicated code and maintain consistency.Possible Drawbacks
I also deleted the
dotcase, But I don't know if the size difference between dot for win32(.) and dot for the others(․) is a problem.So I think this might be a problem.
Applicable issues
[WSL] Test report corruption #4353
The above issue is not directly related to the PR.
But I think you may want to use alphabets rather than
log-symbolsto resolve the issue.like this
Please leave a good comment or question at any time :)