forked from yargs/cliui
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle strings the same in cjs, esm, and deno
This also ports some of the `// istanbul ignore` comments to their associated `/* c8 ignore start/stop */` equivalents, and coverage-ignores some value fallbacks that are there for safety but can never be hit in normal usage. Fix: yargs#138
- Loading branch information
Showing
8 changed files
with
74 additions
and
48 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -49,9 +49,12 @@ | |
"author": "Ben Coe <[email protected]>", | ||
"license": "ISC", | ||
"dependencies": { | ||
"string-width": "^4.2.0", | ||
"strip-ansi": "^6.0.1", | ||
"wrap-ansi": "^7.0.0" | ||
"string-width": "^5.1.2", | ||
"string-width-cjs": "npm:string-width@^4.2.0", | ||
"strip-ansi": "^7.0.1", | ||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1", | ||
"wrap-ansi": "^8.1.0", | ||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.0.27", | ||
|
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,34 @@ | ||
'use strict' | ||
|
||
/* global describe, it */ | ||
|
||
require('chai').should() | ||
|
||
const text = `usage: git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e] | ||
<tagname> [<commit> | <object>] | ||
or: git tag -d <tagname>... | ||
or: git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>] | ||
[--points-at <object>] [--column[=<options>] | --no-column] | ||
[--create-reflog] [--sort=<key>] [--format=<format>] | ||
[--merged <commit>] [--no-merged <commit>] [<pattern>...] | ||
or: git tag -v [--format=<format>] <tagname>...` | ||
|
||
|
||
const cliuiCJS = require('../build/index.cjs') | ||
import('../index.mjs').then(({ default: cliuiESM }) => { | ||
describe('consistent wrapping', () => { | ||
it('should produce matching output in cjs and esm', () => { | ||
const uiCJS = cliuiCJS({}) | ||
const uiESM = cliuiESM({}) | ||
uiCJS.div({ | ||
padding: [0, 0, 0, 0], | ||
text, | ||
}) | ||
uiESM.div({ | ||
padding: [0, 0, 0, 0], | ||
text, | ||
}) | ||
uiCJS.toString().should.equal(uiESM.toString()) | ||
}) | ||
}) | ||
}) |
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