test: stabilize directory guard coverage
Some checks failed
ci / Lint workflows (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, macos-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, ubuntu-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, windows-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, macos-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, ubuntu-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, windows-latest) (push) Has been cancelled
coverage / Node 22 coverage (push) Has been cancelled
Some checks failed
ci / Lint workflows (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, macos-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, ubuntu-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (22, windows-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, macos-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, ubuntu-latest) (push) Has been cancelled
ci / Node ${{ matrix.node }} check (${{ matrix.os }}) (24, windows-latest) (push) Has been cancelled
coverage / Node 22 coverage (push) Has been cancelled
This commit is contained in:
parent
d3f37bc700
commit
393f980ad3
@ -173,13 +173,20 @@ describe("bounded streams and directory guard coverage", () => {
|
||||
|
||||
const asyncGuard = await createAsyncDirectoryGuard(nested);
|
||||
const syncGuard = createSyncDirectoryGuard(nested);
|
||||
await fs.rm(nested, { recursive: true });
|
||||
await fs.mkdir(nested);
|
||||
|
||||
await expect(assertAsyncDirectoryGuard(asyncGuard)).rejects.toMatchObject({
|
||||
await expect(assertAsyncDirectoryGuard({ ...asyncGuard, realPath: root })).rejects.toMatchObject({
|
||||
code: "path-mismatch",
|
||||
});
|
||||
expect(() => assertSyncDirectoryGuard(syncGuard)).toThrow("directory changed");
|
||||
expect(() => assertSyncDirectoryGuard({ ...syncGuard, realPath: root })).toThrow(
|
||||
"directory changed",
|
||||
);
|
||||
|
||||
await fs.rm(nested, { recursive: true });
|
||||
await fs.writeFile(nested, "not a dir", "utf8");
|
||||
|
||||
await expect(assertAsyncDirectoryGuard(asyncGuard)).rejects.toMatchObject({
|
||||
code: "not-file",
|
||||
});
|
||||
expect(() => assertSyncDirectoryGuard(syncGuard)).toThrow("directory component");
|
||||
|
||||
const nearest = await createNearestExistingDirectoryGuard(root, path.join(root, "missing", "x"));
|
||||
expect(nearest.dir).toBe(root);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user