Upstream mrmlnc/fast-glob state of the touched files before e48054e0d4
This commit is contained in:
1 parent
e246fef883
commit
75a80a0c79
2 files changed
+2
-31
No files matched your search
@@ -77,30 +77,6 @@ describe('Readers → Reader', () => {
|
|||||||
assert.ok(actual.dirent.isFile());
|
assert.ok(actual.dirent.isFile());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return created entry with the basename as name when the pattern has a directory', () => {
|
|
||||||
const reader = getReader();
|
|
||||||
const pattern = 'directory/config.json';
|
|
||||||
const stats = new Stats({ mode: StatsMode.File });
|
|
||||||
|
|
||||||
const actual = reader.makeEntry(stats, pattern);
|
|
||||||
|
|
||||||
assert.strictEqual(actual.name, 'config.json');
|
|
||||||
assert.strictEqual(actual.path, pattern);
|
|
||||||
assert.strictEqual(actual.dirent.name, 'config.json');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return created entry with the basename as name when the pattern has a leading dot segment', () => {
|
|
||||||
const reader = getReader();
|
|
||||||
const pattern = './config.json';
|
|
||||||
const stats = new Stats({ mode: StatsMode.File });
|
|
||||||
|
|
||||||
const actual = reader.makeEntry(stats, pattern);
|
|
||||||
|
|
||||||
assert.strictEqual(actual.name, 'config.json');
|
|
||||||
assert.strictEqual(actual.path, pattern);
|
|
||||||
assert.strictEqual(actual.dirent.name, 'config.json');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return created entry with fs.Stats', () => {
|
it('should return created entry with fs.Stats', () => {
|
||||||
const reader = getReader({ stats: true });
|
const reader = getReader({ stats: true });
|
||||||
const pattern = 'config.json';
|
const pattern = 'config.json';
|
||||||
|
|||||||
@@ -33,15 +33,10 @@ export abstract class Reader<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _makeEntry(stats: FsStats, pattern: Pattern): Entry {
|
protected _makeEntry(stats: FsStats, pattern: Pattern): Entry {
|
||||||
// A static pattern is the path to the entry, so it is used as the entry path as is.
|
|
||||||
// The name, however, is the basename of that path, the same as for the entries that
|
|
||||||
// the dynamic reader produces, so that both readers return the same shape.
|
|
||||||
const name = path.basename(pattern);
|
|
||||||
|
|
||||||
const entry: Entry = {
|
const entry: Entry = {
|
||||||
name,
|
name: pattern,
|
||||||
path: pattern,
|
path: pattern,
|
||||||
dirent: utils.fs.createDirentFromStats(name, stats),
|
dirent: utils.fs.createDirentFromStats(pattern, stats),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.#settings.stats) {
|
if (this.#settings.stats) {
|
||||||
|
|||||||
Reference in new issue
Block a user