-
-
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.
dev: read fileLists when checking files.
- Loading branch information
Showing
7 changed files
with
122 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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')); | ||
process.stdin.emit('end'); | ||
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
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