Skip to content
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

dev: Do not output the progress twice #2582

Merged
merged 1 commit into from Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
88 changes: 44 additions & 44 deletions packages/cspell/src/__snapshots__/app.test.ts.snap
Expand Up @@ -3,43 +3,43 @@
exports[`Validate cli app --fail-fast no option Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app --fail-fast no option Expect Error: [Function CheckFailed] 2`] = `
"error 1/2 ./samples/fail-fast/first-fail.txt 0.00ms X
"error 0.00ms X
log ./samples/fail-fast/first-fail.txt:1:1 - Unknown word (iamtypo)
error 2/2 ./samples/fail-fast/second-fail.txt 0.00ms X
error 0.00ms X
log ./samples/fail-fast/second-fail.txt:1:1 - Unknown word (iamtypotoo)
error CSpell: Files checked: 2, Issues found: 2 in 2 files"
`;

exports[`Validate cli app --fail-fast no option Expect Error: [Function CheckFailed] 3`] = `
"
1/2 ./samples/fail-fast/first-fail.txt ...
2/2 ./samples/fail-fast/second-fail.txt ..."
1/2 ./samples/fail-fast/first-fail.txt
2/2 ./samples/fail-fast/second-fail.txt"
`;

exports[`Validate cli app --fail-fast with config Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app --fail-fast with config Expect Error: [Function CheckFailed] 2`] = `
"error 1/2 ./samples/fail-fast/first-fail.txt 0.00ms X
"error 0.00ms X
log ./samples/fail-fast/first-fail.txt:1:1 - Unknown word (iamtypo)
error CSpell: Files checked: 1, Issues found: 1 in 1 files"
`;

exports[`Validate cli app --fail-fast with config Expect Error: [Function CheckFailed] 3`] = `
"
1/2 ./samples/fail-fast/first-fail.txt ..."
1/2 ./samples/fail-fast/first-fail.txt"
`;

exports[`Validate cli app --fail-fast with option Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app --fail-fast with option Expect Error: [Function CheckFailed] 2`] = `
"error 1/2 ./samples/fail-fast/first-fail.txt 0.00ms X
"error 0.00ms X
log ./samples/fail-fast/first-fail.txt:1:1 - Unknown word (iamtypo)
error CSpell: Files checked: 1, Issues found: 1 in 1 files"
`;

exports[`Validate cli app --fail-fast with option Expect Error: [Function CheckFailed] 3`] = `
"
1/2 ./samples/fail-fast/first-fail.txt ..."
1/2 ./samples/fail-fast/first-fail.txt"
`;

exports[`Validate cli app --help Expect Error: outputHelp 1`] = `
Expand Down Expand Up @@ -74,29 +74,29 @@ exports[`Validate cli app --help Expect Error: outputHelp 3`] = `""`;
exports[`Validate cli app --no-fail-fast with config Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app --no-fail-fast with config Expect Error: [Function CheckFailed] 2`] = `
"error 1/2 ./samples/fail-fast/first-fail.txt 0.00ms X
"error 0.00ms X
log ./samples/fail-fast/first-fail.txt:1:1 - Unknown word (iamtypo)
error 2/2 ./samples/fail-fast/second-fail.txt 0.00ms X
error 0.00ms X
log ./samples/fail-fast/second-fail.txt:1:1 - Unknown word (iamtypotoo)
error CSpell: Files checked: 2, Issues found: 2 in 2 files"
`;

exports[`Validate cli app --no-fail-fast with config Expect Error: [Function CheckFailed] 3`] = `
"
1/2 ./samples/fail-fast/first-fail.txt ...
2/2 ./samples/fail-fast/second-fail.txt ..."
1/2 ./samples/fail-fast/first-fail.txt
2/2 ./samples/fail-fast/second-fail.txt"
`;

exports[`Validate cli app LICENSE Expect Error: undefined 1`] = `Array []`;

exports[`Validate cli app LICENSE Expect Error: undefined 2`] = `
"error 1/1 ./LICENSE 0.00ms
"error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;

exports[`Validate cli app LICENSE Expect Error: undefined 3`] = `
"
1/1 ./LICENSE ..."
1/1 ./LICENSE"
`;

exports[`Validate cli app bad config Expect Error: [Function CheckFailed] 1`] = `Array []`;
Expand Down Expand Up @@ -285,13 +285,13 @@ exports[`Validate cli app check with spelling errors Expect Error: [Function Che
exports[`Validate cli app cspell-bad.json Expect Error: undefined 1`] = `Array []`;

exports[`Validate cli app cspell-bad.json Expect Error: undefined 2`] = `
"error 1/1 ./src/app.test.ts 0.00ms
"error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;

exports[`Validate cli app cspell-bad.json Expect Error: undefined 3`] = `
"
1/1 ./src/app.test.ts ..."
1/1 ./src/app.test.ts"
`;

exports[`Validate cli app cspell-import-missing.json Expect Error: [Function CheckFailed] 1`] = `Array []`;
Expand Down Expand Up @@ -335,37 +335,37 @@ info Checking: ./src/app.test.ts, File type: auto, Language: default
info Checked: ./src/app.test.ts, File type: typescript, Language: en ... Issues: 0 0.00S
info Config file Used: ./cspell.json
info Dictionaries Used: backwards-compatibility, companies, filetypes, public-licenses, softwareTerms, workspace, aws, cryptocurrencies, en_us, fullstack, node, npm, typescript
error 1/1 ./src/app.test.ts 0.00ms
error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;

exports[`Validate cli app current_file --verbose Expect Error: undefined 3`] = `
"
1/1 ./src/app.test.ts ..."
1/1 ./src/app.test.ts"
`;

exports[`Validate cli app current_file Expect Error: undefined 1`] = `Array []`;

exports[`Validate cli app current_file Expect Error: undefined 2`] = `
"error 1/1 ./src/app.test.ts 0.00ms
"error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;

exports[`Validate cli app current_file Expect Error: undefined 3`] = `
"
1/1 ./src/app.test.ts ..."
1/1 ./src/app.test.ts"
`;

exports[`Validate cli app current_file languageId Expect Error: undefined 1`] = `Array []`;

exports[`Validate cli app current_file languageId Expect Error: undefined 2`] = `
"error 1/1 ./src/app.test.ts 0.00ms
"error 0.00ms
error CSpell: Files checked: 1, Issues found: 0 in 0 files"
`;

exports[`Validate cli app current_file languageId Expect Error: undefined 3`] = `
"
1/1 ./src/app.test.ts ..."
1/1 ./src/app.test.ts"
`;

exports[`Validate cli app link 1`] = `""`;
Expand Down Expand Up @@ -470,7 +470,7 @@ exports[`Validate cli app not found error by default Expect Error: [Function Che
exports[`Validate cli app samples/Dutch.txt Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app samples/Dutch.txt Expect Error: [Function CheckFailed] 2`] = `
"error 1/1 ./samples/Dutch.txt 0.00ms X
"error 0.00ms X
log ./samples/Dutch.txt:1:32 - Unknown word (NEDERLANDS)
log ./samples/Dutch.txt:2:11 - Unknown word (wordt)
log ./samples/Dutch.txt:2:17 - Unknown word (vriendelijk)
Expand Down Expand Up @@ -665,7 +665,7 @@ error CSpell: Files checked: 1, Issues found: 189 in 1 files"

exports[`Validate cli app samples/Dutch.txt Expect Error: [Function CheckFailed] 3`] = `
"
1/1 ./samples/Dutch.txt ..."
1/1 ./samples/Dutch.txt"
`;

exports[`Validate cli app success suggest run with ["suggest", "café", "--num-suggestions=1", "--no-include-ties"] 1`] = `Array []`;
Expand Down Expand Up @@ -1267,12 +1267,12 @@ not-in-any-dictionary - workspace* ../../cspell-dict.txt"
exports[`Validate cli app with errors and excludes Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app with errors and excludes Expect Error: [Function CheckFailed] 2`] = `
"error 1/6 ./samples/cspell-bad.json 0.00ms
error 2/6 ./samples/cspell-includes.json 0.00ms
error 3/6 ./samples/cspell-missing-dict.json 0.00ms
error 4/6 ./samples/sample.c 0.00ms
error 5/6 ./samples/sample.py 0.00ms
error 6/6 ./samples/text.txt 0.00ms X
"error 0.00ms
error 0.00ms
error 0.00ms
error 0.00ms
error 0.00ms
error 0.00ms X
log ./samples/text.txt:1:14 - Unknown word (fulll)
log ./samples/text.txt:1:23 - Unknown word (errrorrrs)
log ./samples/text.txt:3:4 - Unknown word (hass)
Expand All @@ -1285,18 +1285,18 @@ error CSpell: Files checked: 6, Issues found: 7 in 1 files"

exports[`Validate cli app with errors and excludes Expect Error: [Function CheckFailed] 3`] = `
"
1/6 ./samples/cspell-bad.json ...
2/6 ./samples/cspell-includes.json ...
3/6 ./samples/cspell-missing-dict.json ...
4/6 ./samples/sample.c ...
5/6 ./samples/sample.py ...
6/6 ./samples/text.txt ..."
1/6 ./samples/cspell-bad.json
2/6 ./samples/cspell-includes.json
3/6 ./samples/cspell-missing-dict.json
4/6 ./samples/sample.c
5/6 ./samples/sample.py
6/6 ./samples/text.txt"
`;

exports[`Validate cli app with forbidden words Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app with forbidden words Expect Error: [Function CheckFailed] 2`] = `
"error 1/1 ./samples/src/sample-with-forbidden-words.md 0.00ms X
"error 0.00ms X
log ./samples/src/sample-with-forbidden-words.md:3:3 - Forbidden word (behaviour)
log ./samples/src/sample-with-forbidden-words.md:4:3 - Forbidden word (flavour)
log ./samples/src/sample-with-forbidden-words.md:5:3 - Forbidden word (colour)
Expand All @@ -1305,7 +1305,7 @@ error CSpell: Files checked: 1, Issues found: 3 in 1 files"

exports[`Validate cli app with forbidden words Expect Error: [Function CheckFailed] 3`] = `
"
1/1 ./samples/src/sample-with-forbidden-words.md ..."
1/1 ./samples/src/sample-with-forbidden-words.md"
`;

exports[`Validate cli app with spelling errors --debug Dutch.txt Expect Error: [Function CheckFailed] 1`] = `Array []`;
Expand Down Expand Up @@ -1511,7 +1511,7 @@ exports[`Validate cli app with spelling errors --silent Dutch.txt Expect Error:
exports[`Validate cli app with spelling errors Dutch.txt --legacy Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app with spelling errors Dutch.txt --legacy Expect Error: [Function CheckFailed] 2`] = `
"error 1/1 ./samples/Dutch.txt 0.00ms X
"error 0.00ms X
log ./samples/Dutch.txt[1, 32]: Unknown word: NEDERLANDS
log ./samples/Dutch.txt[2, 11]: Unknown word: wordt
log ./samples/Dutch.txt[2, 17]: Unknown word: vriendelijk
Expand Down Expand Up @@ -1706,13 +1706,13 @@ error CSpell: Files checked: 1, Issues found: 189 in 1 files"

exports[`Validate cli app with spelling errors Dutch.txt --legacy Expect Error: [Function CheckFailed] 3`] = `
"
1/1 ./samples/Dutch.txt ..."
1/1 ./samples/Dutch.txt"
`;

exports[`Validate cli app with spelling errors Dutch.txt Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app with spelling errors Dutch.txt Expect Error: [Function CheckFailed] 2`] = `
"error 1/1 ./samples/Dutch.txt 0.00ms X
"error 0.00ms X
log ./samples/Dutch.txt:1:32 - Unknown word (NEDERLANDS)
log ./samples/Dutch.txt:2:11 - Unknown word (wordt)
log ./samples/Dutch.txt:2:17 - Unknown word (vriendelijk)
Expand Down Expand Up @@ -1907,13 +1907,13 @@ error CSpell: Files checked: 1, Issues found: 189 in 1 files"

exports[`Validate cli app with spelling errors Dutch.txt Expect Error: [Function CheckFailed] 3`] = `
"
1/1 ./samples/Dutch.txt ..."
1/1 ./samples/Dutch.txt"
`;

exports[`Validate cli app with spelling errors Dutch.txt words only Expect Error: [Function CheckFailed] 1`] = `Array []`;

exports[`Validate cli app with spelling errors Dutch.txt words only Expect Error: [Function CheckFailed] 2`] = `
"error 1/1 ./samples/Dutch.txt 0.00ms X
"error 0.00ms X
log NEDERLANDS
log wordt
log vriendelijk
Expand Down Expand Up @@ -2108,5 +2108,5 @@ error CSpell: Files checked: 1, Issues found: 189 in 1 files"

exports[`Validate cli app with spelling errors Dutch.txt words only Expect Error: [Function CheckFailed] 3`] = `
"
1/1 ./samples/Dutch.txt ..."
1/1 ./samples/Dutch.txt"
`;
8 changes: 2 additions & 6 deletions packages/cspell/src/cli-reporter.ts
Expand Up @@ -80,18 +80,14 @@ function reportProgressFileBegin(p: ProgressFileBegin) {
const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
const idx = fn + '/' + fc;
const filename = chalk.gray(relativeFilename(p.filename));
process.stderr.write(`\r${idx} ${filename} ...`);
process.stderr.write(`\r${idx} ${filename}`);
}

function reportProgressFileComplete(p: ProgressFileComplete) {
const fc = '' + p.fileCount;
const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
const idx = fn + '/' + fc;
const filename = chalk.gray(relativeFilename(p.filename));
const time = reportTime(p.elapsedTimeMs, !!p.cached);
const skipped = p.processed === false ? ' skipped' : '';
const hasErrors = p.numErrors ? chalk.red` X` : '';
console.error(`\r${idx} ${filename} ${time}${skipped}${hasErrors}`);
console.error(` ${time}${skipped}${hasErrors}`);
}

function reportTime(elapsedTimeMs: number | undefined, cached: boolean): string {
Expand Down