-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support
--file-list
cli option (#2130)
* feat: Support `--file-list` cli option Related to #1850 * dev: read fileLists when checking files. * dev: Improve error handling * Update GitPod config to reduce number of pre-builds
- Loading branch information
Showing
21 changed files
with
274 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
tasks: | ||
- init: npm install && npm run build | ||
- init: npm install | ||
command: npm run build | ||
vscode: | ||
extensions: | ||
- streetsidesoftware.code-spell-checker | ||
github: | ||
prebuilds: | ||
master: true | ||
branches: false | ||
pullRequests: false | ||
pullRequestsFromForks: false | ||
addCheck: false | ||
addComment: false | ||
addBadge: false |
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 |
---|---|---|
|
@@ -42,6 +42,7 @@ packlist | |
pagekit | ||
patreon | ||
popd | ||
prebuilds | ||
pushd | ||
pycontribs | ||
rebased | ||
|
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
3 changes: 3 additions & 0 deletions
3
packages/cspell/fixtures/features/file-list/files-to-check-missing.txt
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,3 @@ | ||
missing-file.txt | ||
../../../src/app.ts | ||
../../../README.md |
2 changes: 2 additions & 0 deletions
2
packages/cspell/fixtures/features/file-list/files-to-check.txt
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,2 @@ | ||
../../../src/app.ts | ||
../../../README.md |
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,3 @@ | ||
file1 | ||
../file2 | ||
dir/file3 |
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 @@ | ||
file2.txt |
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 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,36 @@ | ||
import { readFileListFile, readFileListFiles } from './fileHelper'; | ||
import * as path from 'path'; | ||
|
||
const fixtures = path.join(__dirname, '../fixtures/fileHelper'); | ||
const fileListFile = path.join(fixtures, 'file-list.txt'); | ||
const fileListFile2 = path.join(fixtures, 'nested/file-list-2.txt'); | ||
|
||
const oc = expect.objectContaining; | ||
|
||
describe('fileHelper', () => { | ||
test('readFileListFile', async () => { | ||
try { | ||
const files = ['a', 'b', 'c']; | ||
process.stdin.isTTY = false; | ||
const pResult = readFileListFile('stdin'); | ||
process.stdin.push(files.join('\n')); | ||
// need to delay the `end` event or it might become a race condition. | ||
setTimeout(() => process.stdin.emit('end'), 1); | ||
const r = await pResult; | ||
expect(r).toEqual(files.map((f) => path.resolve(f))); | ||
} finally { | ||
process.stdin.isTTY = true; | ||
} | ||
}); | ||
|
||
test('readFileListFiles', async () => { | ||
const files = ['file1', '../file2', 'dir/file3', 'nested/file2.txt']; | ||
const r = await readFileListFiles([fileListFile, fileListFile2]); | ||
expect(r).toEqual(files.map((f) => path.resolve(fixtures, f))); | ||
}); | ||
|
||
test('readFileListFiles Error', () => { | ||
const r = readFileListFiles(['not-found.txt']); | ||
return expect(r).rejects.toEqual(oc({ message: 'Error reading file: "not-found.txt"' })); | ||
}); | ||
}); |
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
Oops, something went wrong.