Skip to content

Commit

Permalink
test bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bn-l committed Apr 3, 2024
1 parent 55d8ba4 commit 2727b84
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 42 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ghe -h
### paths

One or more paths to download. Can be a whole
repo, a folder or a file. Supports globs.
repo, a folder or a file. Supports globs but the path should be quoted.
To exclude use a negative glob ("!" at the beginning).
Can mix paths from different repos (conflicts resolved
left to right). A trailing slash means a whole folder.
Expand Down Expand Up @@ -85,7 +85,7 @@ ghe facebook/react
```
Specific folder:
```bash
ghe facebook/react/packages/*
ghe "facebook/react/packages/*"
```
Specify destination:
```bash
Expand All @@ -109,9 +109,9 @@ ghe -lc -d local/dest facebook/react
```
Specific folder
```bash
ghe -l facebook/react/.circleci/*
ghe -l "facebook/react/.circleci/*"
```


<!-- Everything after the snip is snipped off -->
<!-- SNIP -->
<!-- SNIP -->
23 changes: 13 additions & 10 deletions coverage/lcov-report/cli.mts.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>132/132</span>
<span class='fraction'>133/133</span>
</div>


Expand All @@ -46,7 +46,7 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>132/132</span>
<span class='fraction'>133/133</span>
</div>


Expand Down Expand Up @@ -195,7 +195,8 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
<a name='L130'></a><a href='#L130'>130</a>
<a name='L131'></a><a href='#L131'>131</a>
<a name='L132'></a><a href='#L132'>132</a>
<a name='L133'></a><a href='#L133'>133</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<a name='L133'></a><a href='#L133'>133</a>
<a name='L134'></a><a href='#L134'>134</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
Expand Down Expand Up @@ -270,6 +271,7 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">21x</span>
Expand Down Expand Up @@ -367,10 +369,11 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
&nbsp;
${ c.strong("Arguments:") }
paths One or more paths to download. Can be a whole
repo, a folder or a file. ${ c.strong("Supports globs") }.
To exclude use a negative glob ("!" at the beginning).
Can mix paths from different repos (conflicts resolved
left to right). A trailing slash means a whole folder.
repo, a folder or a file. ${ c.strong("Supports globs") }
but the path should be quoted. To exclude use a negative
glob ("!" at the beginning). Can mix paths from different
repos (conflicts resolved left to right). A trailing slash
means a whole folder.
${ c.strong("Options:") }
-l, --list List files. Useful as a dry run and with fzf. Does not
download. Will show show conflicts for the current
Expand All @@ -388,14 +391,14 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
&nbsp;
${ c.strong("Download Examples:") }
Entire repo ${ c.binColor(name) + " facebook/react" }
Specific folder ${ c.binColor(name) + " facebook/react/packages/*" }
Specific folder ${ c.binColor(name) + " \"facebook/react/packages/*\"" }
Specify destination ${ c.binColor(name) + " -d local/dest facebook/react" }
Specific files ${ c.binColor(name) + " facebook/react/.circleci/config.yml facebook/react/.github/stale.yml" }
Different repos mixed ${ c.binColor(name) + " facebook/react micromatch/picomatch" }
&nbsp;
${ c.strong("List Examples:") }
Only conflicts ${ c.binColor(name) + " -lc -d local/dest facebook/react" }
Specific folder ${ c.binColor(name) + " -l facebook/react/.circleci/*" }
Specific folder ${ c.binColor(name) + " -l \"facebook/react/.circleci/*\"" }
&nbsp;
For a video demo of usage see: ${ c.strong(docsUrl) }
`;
Expand Down Expand Up @@ -466,7 +469,7 @@ <h1><a href="index.html">All files</a> cli.mts</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-03T17:20:45.939Z
at 2024-04-03T17:46:02.307Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
10 changes: 5 additions & 5 deletions coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>All files</h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>295/295</span>
<span class='fraction'>296/296</span>
</div>


Expand All @@ -46,7 +46,7 @@ <h1>All files</h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>295/295</span>
<span class='fraction'>296/296</span>
</div>


Expand Down Expand Up @@ -84,13 +84,13 @@ <h1>All files</h1>
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="132" class="abs high">132/132</td>
<td data-value="133" class="abs high">133/133</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="11" class="abs high">11/11</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="132" class="abs high">132/132</td>
<td data-value="133" class="abs high">133/133</td>
</tr>

<tr>
Expand All @@ -116,7 +116,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-03T17:20:45.939Z
at 2024-04-03T17:46:02.307Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/main.mts.html
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ <h1><a href="index.html">All files</a> main.mts</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-04-03T17:20:45.939Z
at 2024-04-03T17:46:02.307Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
21 changes: 11 additions & 10 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FN:17,strong
FN:18,careful
FN:19,example
FN:20,binColor
FN:75,getCli
FN:76,getCli
FNF:11
FNH:11
FNDA:21,noColor
Expand Down Expand Up @@ -99,7 +99,7 @@ DA:72,1
DA:73,1
DA:74,1
DA:75,1
DA:76,21
DA:76,1
DA:77,21
DA:78,21
DA:79,21
Expand Down Expand Up @@ -151,13 +151,14 @@ DA:124,21
DA:125,21
DA:126,21
DA:127,21
DA:128,1
DA:128,21
DA:129,1
DA:130,1
DA:131,20
DA:131,1
DA:132,20
LF:132
LH:132
DA:133,20
LF:133
LH:133
BRDA:6,0,0,21
BRDA:6,1,0,6
BRDA:10,2,0,78
Expand All @@ -172,10 +173,10 @@ BRDA:18,10,0,6
BRDA:19,11,0,2
BRDA:20,12,0,34
BRDA:26,13,0,4
BRDA:75,14,0,21
BRDA:124,15,0,6
BRDA:127,16,0,1
BRDA:130,17,0,20
BRDA:76,14,0,21
BRDA:125,15,0,6
BRDA:128,16,0,1
BRDA:131,17,0,20
BRF:18
BRH:18
end_of_record
Expand Down
13 changes: 7 additions & 6 deletions source/cli.mts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ export const helpText = `
${ c.strong("Arguments:") }
paths One or more paths to download. Can be a whole
repo, a folder or a file. ${ c.strong("Supports globs") }.
To exclude use a negative glob ("!" at the beginning).
Can mix paths from different repos (conflicts resolved
left to right). A trailing slash means a whole folder.
repo, a folder or a file. ${ c.strong("Supports globs") }
but the path should be quoted. To exclude use a negative
glob ("!" at the beginning). Can mix paths from different
repos (conflicts resolved left to right). A trailing slash
means a whole folder.
${ c.strong("Options:") }
-l, --list List files. Useful as a dry run and with fzf. Does not
download. Will show show conflicts for the current
Expand All @@ -59,14 +60,14 @@ export const helpText = `
${ c.strong("Download Examples:") }
Entire repo ${ c.binColor(name) + " facebook/react" }
Specific folder ${ c.binColor(name) + " facebook/react/packages/*" }
Specific folder ${ c.binColor(name) + " \"facebook/react/packages/*\"" }
Specify destination ${ c.binColor(name) + " -d local/dest facebook/react" }
Specific files ${ c.binColor(name) + " facebook/react/.circleci/config.yml facebook/react/.github/stale.yml" }
Different repos mixed ${ c.binColor(name) + " facebook/react micromatch/picomatch" }
${ c.strong("List Examples:") }
Only conflicts ${ c.binColor(name) + " -lc -d local/dest facebook/react" }
Specific folder ${ c.binColor(name) + " -l facebook/react/.circleci/*" }
Specific folder ${ c.binColor(name) + " -l \"facebook/react/.circleci/*\"" }
For a video demo of usage see: ${ c.strong(docsUrl) }
`;
Expand Down
11 changes: 5 additions & 6 deletions test/cli.unit.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { getCli, c, Option } from "../source/cli.mjs";
import {describe, it, expect, beforeEach, afterEach } from "vitest";
import sinon from 'sinon';
import stripAnsi from "strip-ansi";

describe("CLI tests", () => {

Expand Down Expand Up @@ -127,17 +128,15 @@ describe('cli.mts', () => {
it(`should correctly log the ${method} with color`, () => {
c.showColor = true;
// @ts-expect-error testing
const colorized = c[method]('test');
const ansiEscapeCodes = /\x1b\[[0-9;]*m/;
expect(colorized).to.match(ansiEscapeCodes);
const stripped = stripAnsi(c[method]('test'));
expect(stripped).to.match(/test/);
});

it(`should correctly log ${method} without color`, () => {
c.showColor = false;
// @ts-expect-error testing
const colorized = c[method]('test');
const ansiEscapeCodes = /\x1b\[[0-9;]*m/;
expect(colorized).to.not.match(ansiEscapeCodes);
const stripped = stripAnsi(c[method]('test'));
expect(stripped).to.match(/test/);
});
});
});

0 comments on commit 2727b84

Please sign in to comment.