Skip to content

Commit b9a5efa

Browse files
fiskermdjermanovic
andauthored
test: skip symlink test on Windows (#19503)
* test: allow skip symlink test on Windows * test: skip on windows * Update tests/lib/cli-engine/file-enumerator.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * chore: restore files, I don't know what happened * chore: restore files, I don't know what happened * style: fix code style --------- Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
1 parent 46eea6d commit b9a5efa

1 file changed

Lines changed: 53 additions & 51 deletions

File tree

tests/lib/cli-engine/file-enumerator.js

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -763,64 +763,66 @@ describe("FileEnumerator", () => {
763763
});
764764
});
765765

766-
describe("if contains symbolic links", async () => {
767-
const root = path.join(os.tmpdir(), "eslint/file-enumerator");
768-
const files = {
769-
"dir1/1.js": "",
770-
"dir1/2.js": "",
771-
"top-level.js": "",
772-
".eslintrc.json": JSON.stringify({ rules: {} }),
773-
};
774-
const dir2 = path.join(root, "dir2");
775-
const { prepare, cleanup } = createCustomTeardown({
776-
cwd: root,
777-
files,
778-
});
766+
if (process.platform !== "win32" || process.env.CI === "true") {
767+
describe("if contains symbolic links", async () => {
768+
const root = path.join(os.tmpdir(), "eslint/file-enumerator");
769+
const files = {
770+
"dir1/1.js": "",
771+
"dir1/2.js": "",
772+
"top-level.js": "",
773+
".eslintrc.json": JSON.stringify({ rules: {} }),
774+
};
775+
const dir2 = path.join(root, "dir2");
776+
const { prepare, cleanup } = createCustomTeardown({
777+
cwd: root,
778+
files,
779+
});
780+
781+
beforeEach(async () => {
782+
await prepare();
783+
fs.mkdirSync(dir2);
784+
fs.symlinkSync(
785+
path.join(root, "top-level.js"),
786+
path.join(dir2, "top.js"),
787+
"file",
788+
);
789+
fs.symlinkSync(
790+
path.join(root, "dir1"),
791+
path.join(dir2, "nested"),
792+
"dir",
793+
);
794+
});
779795

780-
beforeEach(async () => {
781-
await prepare();
782-
fs.mkdirSync(dir2);
783-
fs.symlinkSync(
784-
path.join(root, "top-level.js"),
785-
path.join(dir2, "top.js"),
786-
"file",
787-
);
788-
fs.symlinkSync(
789-
path.join(root, "dir1"),
790-
path.join(dir2, "nested"),
791-
"dir",
792-
);
793-
});
796+
afterEach(cleanup);
794797

795-
afterEach(cleanup);
798+
it("should resolve", () => {
799+
const enumerator = new FileEnumerator({ cwd: root });
800+
const list = Array.from(
801+
enumerator.iterateFiles(["dir2/**/*.js"]),
802+
).map(({ filePath }) => filePath);
796803

797-
it("should resolve", () => {
798-
const enumerator = new FileEnumerator({ cwd: root });
799-
const list = Array.from(
800-
enumerator.iterateFiles(["dir2/**/*.js"]),
801-
).map(({ filePath }) => filePath);
802-
803-
assert.deepStrictEqual(list, [
804-
path.join(dir2, "nested", "1.js"),
805-
path.join(dir2, "nested", "2.js"),
806-
path.join(dir2, "top.js"),
807-
]);
808-
});
804+
assert.deepStrictEqual(list, [
805+
path.join(dir2, "nested", "1.js"),
806+
path.join(dir2, "nested", "2.js"),
807+
path.join(dir2, "top.js"),
808+
]);
809+
});
809810

810-
it("should ignore broken links", () => {
811-
fs.unlinkSync(path.join(root, "top-level.js"));
811+
it("should ignore broken links", () => {
812+
fs.unlinkSync(path.join(root, "top-level.js"));
812813

813-
const enumerator = new FileEnumerator({ cwd: root });
814-
const list = Array.from(
815-
enumerator.iterateFiles(["dir2/**/*.js"]),
816-
).map(({ filePath }) => filePath);
814+
const enumerator = new FileEnumerator({ cwd: root });
815+
const list = Array.from(
816+
enumerator.iterateFiles(["dir2/**/*.js"]),
817+
).map(({ filePath }) => filePath);
817818

818-
assert.deepStrictEqual(list, [
819-
path.join(dir2, "nested", "1.js"),
820-
path.join(dir2, "nested", "2.js"),
821-
]);
819+
assert.deepStrictEqual(list, [
820+
path.join(dir2, "nested", "1.js"),
821+
path.join(dir2, "nested", "2.js"),
822+
]);
823+
});
822824
});
823-
});
825+
}
824826
});
825827

826828
// https://github.com/eslint/eslint/issues/13789

0 commit comments

Comments
 (0)