mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[fs-detectors] Use LocalFileSystemDetector instead of FixtureFilesystem (#10100)
The code for these two are almost identical, so consolidate into one codebase. Also adjusts the `pnpm test` script to allow for specifying a file name to be executed, instead of running all tests.
This commit is contained in:
@@ -5,7 +5,7 @@ import { LocalFileSystemDetector, DetectorFilesystem } from '../src';
|
||||
|
||||
const tmpdir = path.join(os.tmpdir(), 'local-file-system-test');
|
||||
|
||||
const dirs = ['', 'a', 'a/b']; // root, single-nested, double-nested
|
||||
const dirs = ['', 'a', `a${path.sep}b`]; // root, single-nested, double-nested
|
||||
const files = ['foo', 'bar'];
|
||||
const filePaths = dirs.flatMap(dir => files.map(file => path.join(dir, file)));
|
||||
|
||||
@@ -63,12 +63,7 @@ describe('LocalFileSystemDetector', () => {
|
||||
const readdirResults = await Promise.all(
|
||||
dirs.map(dir => localFileSystem.readdir(dir))
|
||||
);
|
||||
const expectedPaths = [
|
||||
...dirs.map(dir => path.join(tmpdir, dir)),
|
||||
...filePaths.map(filePath => path.join(tmpdir, filePath)),
|
||||
]
|
||||
.sort()
|
||||
.slice(1); // drop the first path since its the root
|
||||
const expectedPaths = [...dirs, ...filePaths].sort().slice(1); // drop the first path since its the root
|
||||
const actualPaths = readdirResults
|
||||
.flatMap(result => result.map(stat => stat.path))
|
||||
.sort();
|
||||
|
||||
Reference in New Issue
Block a user