mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-09-20 11:01:30 +00:00
test: fix Windows path assertions (#422)
Amp-Thread-ID: https://ampcode.com/threads/T-01a0af62-d8be-7209-b38b-950badf6ef76 Closes: #394 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import * as path from "node:path";
|
||||||
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
||||||
import * as semver from "semver";
|
import * as semver from "semver";
|
||||||
|
|
||||||
@@ -450,7 +451,7 @@ describe("download-version", () => {
|
|||||||
|
|
||||||
expect(mockExtractTar).toHaveBeenCalledWith("/tmp/downloaded");
|
expect(mockExtractTar).toHaveBeenCalledWith("/tmp/downloaded");
|
||||||
expect(mockCacheDir).toHaveBeenCalledWith(
|
expect(mockCacheDir).toHaveBeenCalledWith(
|
||||||
"/tmp/extracted/ruff-x86_64-unknown-linux-gnu",
|
path.join("/tmp/extracted", "ruff-x86_64-unknown-linux-gnu"),
|
||||||
"ruff",
|
"ruff",
|
||||||
"0.15.8",
|
"0.15.8",
|
||||||
"x86_64",
|
"x86_64",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const {
|
|||||||
const { findPyprojectToml } = await import("../../src/utils/pyproject-finder");
|
const { findPyprojectToml } = await import("../../src/utils/pyproject-finder");
|
||||||
|
|
||||||
let tempDir: string | undefined;
|
let tempDir: string | undefined;
|
||||||
|
const symlinkTest = process.platform === "win32" ? it.skip : it;
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
if (tempDir !== undefined) {
|
if (tempDir !== undefined) {
|
||||||
@@ -177,7 +178,7 @@ describe("expandSourceInput", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not traverse symlinked directories", async () => {
|
symlinkTest("does not traverse symlinked directories", async () => {
|
||||||
const projectDir = await createTempProject();
|
const projectDir = await createTempProject();
|
||||||
const externalDir = path.join(projectDir, "external");
|
const externalDir = path.join(projectDir, "external");
|
||||||
const symlinkPath = path.join(projectDir, "src", "linked");
|
const symlinkPath = path.join(projectDir, "src", "linked");
|
||||||
@@ -368,7 +369,7 @@ describe("getSourceBasePath", () => {
|
|||||||
|
|
||||||
it("does not treat brace expansion as glob syntax", async () => {
|
it("does not treat brace expansion as glob syntax", async () => {
|
||||||
await expect(getSourceBasePath("src/{a,b}/*.py")).resolves.toBe(
|
await expect(getSourceBasePath("src/{a,b}/*.py")).resolves.toBe(
|
||||||
"src/{a,b}",
|
path.join("src", "{a,b}"),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user