2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2024-06-20 07:39:45 +00:00
|
|
|
import {
|
|
|
|
assert,
|
|
|
|
assertEquals,
|
|
|
|
assertRejects,
|
|
|
|
assertStringIncludes,
|
|
|
|
assertThrows,
|
|
|
|
} from "@std/assert";
|
2024-04-29 02:57:30 +00:00
|
|
|
import { fromFileUrl, join, joinGlobs, normalize, relative } from "@std/path";
|
2019-10-16 18:39:33 +00:00
|
|
|
import {
|
|
|
|
expandGlob,
|
2024-02-27 21:57:25 +00:00
|
|
|
type ExpandGlobOptions,
|
2020-03-28 17:03:49 +00:00
|
|
|
expandGlobSync,
|
2019-10-16 18:39:33 +00:00
|
|
|
} from "./expand_glob.ts";
|
2024-09-11 10:17:27 +00:00
|
|
|
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";
|
2019-10-16 18:39:33 +00:00
|
|
|
|
|
|
|
async function expandGlobArray(
|
|
|
|
globString: string,
|
2020-07-14 19:24:17 +00:00
|
|
|
options: ExpandGlobOptions,
|
2023-10-24 07:51:33 +00:00
|
|
|
{ forceRoot = "" } = {},
|
2019-10-16 18:39:33 +00:00
|
|
|
): Promise<string[]> {
|
2023-11-10 19:00:28 +00:00
|
|
|
const paths = await Array.fromAsync(
|
|
|
|
expandGlob(globString, options),
|
|
|
|
({ path }) => path,
|
|
|
|
);
|
2019-10-16 18:39:33 +00:00
|
|
|
paths.sort();
|
2023-11-23 06:59:59 +00:00
|
|
|
const root = normalize(forceRoot || options.root || Deno.cwd());
|
|
|
|
for (const path of paths) {
|
|
|
|
assert(path.startsWith(root));
|
|
|
|
}
|
|
|
|
const relativePaths = paths.map(
|
|
|
|
(path: string): string => relative(root, path) || ".",
|
|
|
|
);
|
|
|
|
relativePaths.sort();
|
|
|
|
return relativePaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
function expandGlobSyncArray(
|
|
|
|
globString: string,
|
|
|
|
options: ExpandGlobOptions,
|
|
|
|
{ forceRoot = "" } = {},
|
|
|
|
): string[] {
|
2019-10-16 18:39:33 +00:00
|
|
|
const pathsSync = [...expandGlobSync(globString, options)].map(
|
2020-07-14 19:24:17 +00:00
|
|
|
({ path }): string => path,
|
2019-10-16 18:39:33 +00:00
|
|
|
);
|
|
|
|
pathsSync.sort();
|
2023-10-24 07:51:33 +00:00
|
|
|
const root = normalize(forceRoot || options.root || Deno.cwd());
|
2023-11-23 06:59:59 +00:00
|
|
|
for (const path of pathsSync) {
|
2019-10-16 18:39:33 +00:00
|
|
|
assert(path.startsWith(root));
|
|
|
|
}
|
2023-11-23 06:59:59 +00:00
|
|
|
const relativePaths = pathsSync.map(
|
2020-07-14 19:24:17 +00:00
|
|
|
(path: string): string => relative(root, path) || ".",
|
2019-10-16 18:39:33 +00:00
|
|
|
);
|
|
|
|
relativePaths.sort();
|
|
|
|
return relativePaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
const EG_OPTIONS: ExpandGlobOptions = {
|
2020-04-30 10:47:53 +00:00
|
|
|
root: fromFileUrl(new URL(join("testdata", "glob"), import.meta.url)),
|
2019-10-16 18:39:33 +00:00
|
|
|
includeDirs: true,
|
|
|
|
extended: false,
|
|
|
|
};
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlob() with wildcard input returns all test data", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = EG_OPTIONS;
|
|
|
|
assertEquals(await expandGlobArray("*", options), [
|
2021-10-17 18:04:24 +00:00
|
|
|
"a[b]c",
|
2019-10-16 18:39:33 +00:00
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
2023-07-27 13:07:44 +00:00
|
|
|
"link",
|
2020-03-28 17:03:49 +00:00
|
|
|
"subdir",
|
2019-10-16 18:39:33 +00:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with wildcard input returns all test data", function () {
|
|
|
|
const options = EG_OPTIONS;
|
|
|
|
assertEquals(expandGlobSyncArray("*", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
"link",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2024-06-20 07:39:45 +00:00
|
|
|
Deno.test("expandGlob() excludes items in `exclude` option", async function () {
|
|
|
|
const options = { ...EG_OPTIONS, exclude: ["abc"] };
|
|
|
|
assertEquals(await expandGlobArray("*", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
"link",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
assertEquals(expandGlobSyncArray("*", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
"link",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() returns empty array if path doesn't exist", async function () {
|
|
|
|
assertEquals(await expandGlobArray("nonexistent", EG_OPTIONS), []);
|
|
|
|
assertEquals(expandGlobSyncArray("nonexistent", EG_OPTIONS), []);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test(
|
|
|
|
"expandGlob() throws permission error if the runtime doesn't have read permission",
|
|
|
|
{ permissions: {} },
|
|
|
|
async function () {
|
|
|
|
{
|
2024-09-11 10:17:27 +00:00
|
|
|
await assertRejects(
|
|
|
|
async () => {
|
|
|
|
await expandGlobArray("*", EG_OPTIONS);
|
|
|
|
},
|
|
|
|
IS_DENO_2
|
|
|
|
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
? (Deno as any).errors.NotCapable
|
|
|
|
: Deno.errors.PermissionDenied,
|
|
|
|
"run again with the --allow-read flag",
|
2024-06-20 07:39:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2024-09-11 10:17:27 +00:00
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
expandGlobSyncArray("*", EG_OPTIONS);
|
|
|
|
},
|
|
|
|
IS_DENO_2
|
|
|
|
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
? (Deno as any).errors.NotCapable
|
|
|
|
: Deno.errors.PermissionDenied,
|
|
|
|
"run again with the --allow-read flag",
|
2024-06-20 07:39:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlob() with */ input returns subdirs", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = EG_OPTIONS;
|
2023-03-06 07:35:44 +00:00
|
|
|
assertEquals(await expandGlobArray("*/", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"subdir",
|
|
|
|
]);
|
2019-10-16 18:39:33 +00:00
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with */ input returns subdirs", function () {
|
|
|
|
const options = EG_OPTIONS;
|
|
|
|
assertEquals(expandGlobSyncArray("*/", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() with subdir/../* input expands parent", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = EG_OPTIONS;
|
|
|
|
assertEquals(await expandGlobArray("subdir/../*", options), [
|
2021-10-17 18:04:24 +00:00
|
|
|
"a[b]c",
|
2019-10-16 18:39:33 +00:00
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
2023-07-27 13:07:44 +00:00
|
|
|
"link",
|
2020-03-28 17:03:49 +00:00
|
|
|
"subdir",
|
2019-10-16 18:39:33 +00:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with subdir/../* input expands parent", function () {
|
|
|
|
const options = EG_OPTIONS;
|
|
|
|
assertEquals(expandGlobSyncArray("subdir/../*", options), [
|
|
|
|
"a[b]c",
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
"link",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() accepts extended option set as true", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = { ...EG_OPTIONS, extended: true };
|
|
|
|
assertEquals(await expandGlobArray("abc?(def|ghi)", options), [
|
|
|
|
"abc",
|
2020-03-28 17:03:49 +00:00
|
|
|
"abcdef",
|
2019-10-16 18:39:33 +00:00
|
|
|
]);
|
|
|
|
assertEquals(await expandGlobArray("abc*(def|ghi)", options), [
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
2020-03-28 17:03:49 +00:00
|
|
|
"abcdefghi",
|
2019-10-16 18:39:33 +00:00
|
|
|
]);
|
|
|
|
assertEquals(await expandGlobArray("abc+(def|ghi)", options), [
|
|
|
|
"abcdef",
|
2020-03-28 17:03:49 +00:00
|
|
|
"abcdefghi",
|
2019-10-16 18:39:33 +00:00
|
|
|
]);
|
|
|
|
assertEquals(await expandGlobArray("abc@(def|ghi)", options), ["abcdef"]);
|
|
|
|
assertEquals(await expandGlobArray("abc{def,ghi}", options), ["abcdef"]);
|
|
|
|
assertEquals(await expandGlobArray("abc!(def|ghi)", options), ["abc"]);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() accepts extended option set as true", function () {
|
|
|
|
const options = { ...EG_OPTIONS, extended: true };
|
|
|
|
assertEquals(expandGlobSyncArray("abc?(def|ghi)", options), [
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
]);
|
|
|
|
assertEquals(expandGlobSyncArray("abc*(def|ghi)", options), [
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
]);
|
|
|
|
assertEquals(expandGlobSyncArray("abc+(def|ghi)", options), [
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
]);
|
|
|
|
assertEquals(expandGlobSyncArray("abc@(def|ghi)", options), ["abcdef"]);
|
|
|
|
assertEquals(expandGlobSyncArray("abc{def,ghi}", options), ["abcdef"]);
|
|
|
|
assertEquals(expandGlobSyncArray("abc!(def|ghi)", options), ["abc"]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() with globstar returns all dirs", async function () {
|
2023-01-16 15:26:27 +00:00
|
|
|
const options = { ...EG_OPTIONS };
|
2019-10-16 18:39:33 +00:00
|
|
|
assertEquals(
|
2023-01-16 15:26:27 +00:00
|
|
|
await expandGlobArray("**/abc", options),
|
2020-07-14 19:24:17 +00:00
|
|
|
["abc", join("subdir", "abc")],
|
2019-10-16 18:39:33 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with globstar returns all dirs", function () {
|
|
|
|
const options = { ...EG_OPTIONS };
|
|
|
|
assertEquals(
|
|
|
|
expandGlobSyncArray("**/abc", options),
|
|
|
|
["abc", join("subdir", "abc")],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() with globstar parent returns all dirs", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = { ...EG_OPTIONS, globstar: true };
|
|
|
|
assertEquals(
|
|
|
|
await expandGlobArray(joinGlobs(["subdir", "**", ".."], options), options),
|
2020-07-14 19:24:17 +00:00
|
|
|
["."],
|
2019-10-16 18:39:33 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with globstar parent returns all dirs", function () {
|
|
|
|
const options = { ...EG_OPTIONS, globstar: true };
|
|
|
|
assertEquals(
|
|
|
|
expandGlobSyncArray(joinGlobs(["subdir", "**", ".."], options), options),
|
|
|
|
["."],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() with globstar parent and globstar option set to false returns current dir", async function () {
|
2022-10-18 14:40:00 +00:00
|
|
|
const options = { ...EG_OPTIONS, globstar: false };
|
|
|
|
assertEquals(await expandGlobArray("**", options), [
|
|
|
|
".",
|
|
|
|
"a[b]c",
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
2023-07-27 13:07:44 +00:00
|
|
|
"link",
|
2022-10-18 14:40:00 +00:00
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() with globstar parent and globstar option set to false returns current dir", function () {
|
|
|
|
const options = { ...EG_OPTIONS, globstar: false };
|
|
|
|
assertEquals(expandGlobSyncArray("**", options), [
|
|
|
|
".",
|
|
|
|
"a[b]c",
|
|
|
|
"abc",
|
|
|
|
"abcdef",
|
|
|
|
"abcdefghi",
|
|
|
|
"link",
|
|
|
|
"subdir",
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() accepts includeDirs option set to false", async function () {
|
2019-10-16 18:39:33 +00:00
|
|
|
const options = { ...EG_OPTIONS, includeDirs: false };
|
|
|
|
assertEquals(await expandGlobArray("subdir", options), []);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() accepts includeDirs option set to false", function () {
|
|
|
|
const options = { ...EG_OPTIONS, includeDirs: false };
|
|
|
|
assertEquals(expandGlobSyncArray("subdir", options), []);
|
|
|
|
});
|
|
|
|
|
2024-03-04 07:18:37 +00:00
|
|
|
Deno.test(
|
|
|
|
"expandGlob() throws permission error without fs permissions",
|
|
|
|
async function () {
|
|
|
|
const exampleUrl = new URL("testdata/expand_wildcard.js", import.meta.url);
|
|
|
|
const command = new Deno.Command(Deno.execPath(), {
|
|
|
|
args: [
|
|
|
|
"run",
|
|
|
|
"--quiet",
|
|
|
|
"--no-lock",
|
|
|
|
exampleUrl.toString(),
|
|
|
|
],
|
|
|
|
});
|
|
|
|
const { code, success, stdout, stderr } = await command.output();
|
|
|
|
const decoder = new TextDecoder();
|
|
|
|
assert(!success);
|
|
|
|
assertEquals(code, 1);
|
|
|
|
assertEquals(decoder.decode(stdout), "");
|
2024-09-11 10:17:27 +00:00
|
|
|
assertStringIncludes(
|
|
|
|
decoder.decode(stderr),
|
|
|
|
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
|
|
|
|
IS_DENO_2 ? "NotCapable" : "PermissionDenied",
|
|
|
|
);
|
2024-03-04 07:18:37 +00:00
|
|
|
},
|
|
|
|
);
|
2021-10-17 18:04:24 +00:00
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlob() returns single entry when root is not glob", async function () {
|
2021-10-17 18:04:24 +00:00
|
|
|
const options = { ...EG_OPTIONS, root: join(EG_OPTIONS.root!, "a[b]c") };
|
|
|
|
assertEquals(await expandGlobArray("*", options), ["foo"]);
|
|
|
|
});
|
2023-03-06 07:35:44 +00:00
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() returns single entry when root is not glob", function () {
|
|
|
|
const options = { ...EG_OPTIONS, root: join(EG_OPTIONS.root!, "a[b]c") };
|
|
|
|
assertEquals(expandGlobSyncArray("*", options), ["foo"]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() accepts followSymlinks option set to true", async function () {
|
2023-03-06 07:35:44 +00:00
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "link"),
|
|
|
|
followSymlinks: true,
|
|
|
|
};
|
|
|
|
assertEquals(await expandGlobArray("*", options), ["abc"]);
|
|
|
|
});
|
2023-10-16 13:32:15 +00:00
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() accepts followSymlinks option set to true", function () {
|
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "link"),
|
|
|
|
followSymlinks: true,
|
|
|
|
};
|
|
|
|
assertEquals(expandGlobSyncArray("*", options), ["abc"]);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() accepts followSymlinks option set to true with canonicalize", async function () {
|
2023-10-16 13:32:15 +00:00
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "."),
|
|
|
|
followSymlinks: true,
|
|
|
|
};
|
|
|
|
assertEquals(
|
|
|
|
await expandGlobArray("**/abc", options),
|
|
|
|
["abc", join("subdir", "abc")],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() accepts followSymlinks option set to true with canonicalize", function () {
|
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "."),
|
|
|
|
followSymlinks: true,
|
|
|
|
};
|
|
|
|
assertEquals(
|
|
|
|
expandGlobSyncArray("**/abc", options),
|
|
|
|
["abc", join("subdir", "abc")],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("expandGlob() accepts followSymlinks option set to true without canonicalize", async function () {
|
2023-10-16 13:32:15 +00:00
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "."),
|
|
|
|
followSymlinks: true,
|
|
|
|
canonicalize: false,
|
|
|
|
};
|
|
|
|
assertEquals(
|
|
|
|
await expandGlobArray("**/abc", options),
|
|
|
|
["abc", join("link", "abc"), join("subdir", "abc")],
|
|
|
|
);
|
|
|
|
});
|
2023-10-24 07:51:33 +00:00
|
|
|
|
2023-11-23 06:59:59 +00:00
|
|
|
Deno.test("expandGlobSync() accepts followSymlinks option set to true without canonicalize", function () {
|
|
|
|
const options = {
|
|
|
|
...EG_OPTIONS,
|
|
|
|
root: join(EG_OPTIONS.root!, "."),
|
|
|
|
followSymlinks: true,
|
|
|
|
canonicalize: false,
|
|
|
|
};
|
|
|
|
assertEquals(
|
|
|
|
expandGlobSyncArray("**/abc", options),
|
|
|
|
["abc", join("link", "abc"), join("subdir", "abc")],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-10-24 07:51:33 +00:00
|
|
|
Deno.test(
|
2023-11-23 06:59:59 +00:00
|
|
|
"expandGlob() does not require read permissions when root path is specified",
|
2023-10-24 07:51:33 +00:00
|
|
|
{
|
|
|
|
permissions: { read: [EG_OPTIONS.root!] },
|
|
|
|
},
|
|
|
|
async function () {
|
|
|
|
const options = { root: EG_OPTIONS.root! };
|
|
|
|
assertEquals(await expandGlobArray("abc", options), ["abc"]);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
Deno.test(
|
2023-11-23 06:59:59 +00:00
|
|
|
"expandGlobSync() does not require read permissions when root path is specified",
|
|
|
|
{
|
|
|
|
permissions: { read: [EG_OPTIONS.root!] },
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
const options = { root: EG_OPTIONS.root! };
|
|
|
|
assertEquals(expandGlobSyncArray("abc", options), ["abc"]);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
Deno.test(
|
|
|
|
"expandGlob() does not require read permissions when an absolute glob is specified",
|
2023-10-24 07:51:33 +00:00
|
|
|
{
|
|
|
|
permissions: { read: [EG_OPTIONS.root!] },
|
|
|
|
},
|
|
|
|
async function () {
|
|
|
|
assertEquals(
|
|
|
|
await expandGlobArray(`${EG_OPTIONS.root!}/abc`, {}, {
|
|
|
|
forceRoot: EG_OPTIONS.root!,
|
|
|
|
}),
|
|
|
|
["abc"],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
2023-11-23 06:59:59 +00:00
|
|
|
|
|
|
|
Deno.test(
|
|
|
|
"expandGlobSync() does not require read permissions when an absolute glob is specified",
|
|
|
|
{
|
|
|
|
permissions: { read: [EG_OPTIONS.root!] },
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
assertEquals(
|
|
|
|
expandGlobSyncArray(`${EG_OPTIONS.root!}/abc`, {}, {
|
|
|
|
forceRoot: EG_OPTIONS.root!,
|
|
|
|
}),
|
|
|
|
["abc"],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|