diff --git a/src/readers/reader.spec.ts b/src/readers/reader.spec.ts index a29fb95..e0494a8 100644 --- a/src/readers/reader.spec.ts +++ b/src/readers/reader.spec.ts @@ -77,30 +77,6 @@ describe('Readers → Reader', () => { 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', () => { const reader = getReader({ stats: true }); const pattern = 'config.json'; diff --git a/src/readers/reader.ts b/src/readers/reader.ts index bdf3258..427ca72 100644 --- a/src/readers/reader.ts +++ b/src/readers/reader.ts @@ -33,15 +33,10 @@ export abstract class Reader { } 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 = { - name, + name: pattern, path: pattern, - dirent: utils.fs.createDirentFromStats(name, stats), + dirent: utils.fs.createDirentFromStats(pattern, stats), }; if (this.#settings.stats) {