-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This means we don't have two modules for setting colours. - Ability to customise symbols.
- Loading branch information
Showing
6 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import isUnicodeSupported from 'is-unicode-supported' | ||
|
||
jest.mock('is-unicode-supported') | ||
|
||
describe('logSymbols', () => { | ||
|
||
afterEach(() => { | ||
jest.resetModules() | ||
}) | ||
|
||
it('returns Unicode symbols when supported', () => { | ||
(isUnicodeSupported as jest.Mock).mockReturnValue(true) | ||
|
||
const logSymbols = require('../log-symbols').default | ||
|
||
expect(logSymbols).toEqual({ | ||
error: '✗', | ||
info: 'ℹ', | ||
success: '✓', | ||
tipEmoji: '💡', | ||
warning: '⚠', | ||
}) | ||
}) | ||
|
||
it('returns fallback symbols when Unicode is not supported', () => { | ||
(isUnicodeSupported as jest.Mock).mockReturnValue(false) | ||
|
||
const logSymbols = require('../log-symbols').default | ||
|
||
expect(logSymbols).toEqual({ | ||
error: '×', | ||
info: '[i]', | ||
success: '√', | ||
tipEmoji: 'TIP:', | ||
warning: '‼', | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import isUnicodeSupported from 'is-unicode-supported' | ||
|
||
const _isUnicodeSupported = isUnicodeSupported() | ||
|
||
const error = _isUnicodeSupported ? '✗' : '×' | ||
const info = _isUnicodeSupported ? 'ℹ' : '[i]' | ||
const success = _isUnicodeSupported ? '✓' : '√' | ||
const tipEmoji = _isUnicodeSupported ? '💡' : 'TIP:' | ||
const warning = _isUnicodeSupported ? '⚠' : '‼' | ||
|
||
export default { | ||
error, | ||
info, | ||
success, | ||
tipEmoji, | ||
warning, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2431,7 +2431,7 @@ [email protected], chalk@^4.0.0, chalk@^4.0.2: | |
ansi-styles "^4.1.0" | ||
supports-color "^7.1.0" | ||
|
||
[email protected], chalk@^5.3.0: | ||
[email protected]: | ||
version "5.3.0" | ||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" | ||
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== | ||
|
@@ -3461,10 +3461,10 @@ is-stream@^2.0.0: | |
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" | ||
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== | ||
|
||
is-unicode-supported@^1.3.0: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz#d824984b616c292a2e198207d4a609983842f714" | ||
integrity sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ== | ||
is-unicode-supported@2.1.0: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz#09f0ab0de6d3744d48d265ebb98f65d11f2a9b3a" | ||
integrity sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ== | ||
|
||
is-wsl@^2.2.0: | ||
version "2.2.0" | ||
|
@@ -4072,14 +4072,6 @@ lodash.truncate@^4.4.2: | |
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" | ||
integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== | ||
|
||
[email protected]: | ||
version "6.0.0" | ||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-6.0.0.tgz#bb95e5f05322651cac30c0feb6404f9f2a8a9439" | ||
integrity sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw== | ||
dependencies: | ||
chalk "^5.3.0" | ||
is-unicode-supported "^1.3.0" | ||
|
||
lru-cache@^10.2.0: | ||
version "10.2.2" | ||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.2.tgz#48206bc114c1252940c41b25b41af5b545aca878" | ||
|