fix: Windows test compat — shell quoting, line endings, binary names
- Replace single-quoted git commit messages in worktree tests with double quotes (cmd.exe doesn't treat single quotes as delimiters) - Trim stdout in spawn tests to handle \r\n vs \n - Use nonexistent binary name in executable test not-found case
This commit is contained in:
@@ -40,11 +40,11 @@ describe("createWorktree", () => {
|
||||
// Create a git repo with an initial commit
|
||||
mkdirSync(repoDir, { recursive: true });
|
||||
execSync("git init -b main", { cwd: repoDir });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: repoDir });
|
||||
execSync("git config user.name 'Test'", { cwd: repoDir });
|
||||
execSync("echo 'hello' > file.txt", { cwd: repoDir });
|
||||
execSync('git config user.email "test@test.com"', { cwd: repoDir });
|
||||
execSync('git config user.name "Test"', { cwd: repoDir });
|
||||
execSync('echo "hello" > file.txt', { cwd: repoDir });
|
||||
execSync("git add .", { cwd: repoDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'initial'", { cwd: repoDir });
|
||||
execSync('git -c commit.gpgsign=false commit -m "initial"', { cwd: repoDir });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -78,11 +78,11 @@ describe("createWorktree", () => {
|
||||
const varPaseoHome = join(varTempDir, "paseo-home");
|
||||
mkdirSync(varRepoDir, { recursive: true });
|
||||
execSync("git init -b main", { cwd: varRepoDir });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: varRepoDir });
|
||||
execSync("git config user.name 'Test'", { cwd: varRepoDir });
|
||||
execSync("echo 'hello' > file.txt", { cwd: varRepoDir });
|
||||
execSync('git config user.email "test@test.com"', { cwd: varRepoDir });
|
||||
execSync('git config user.name "Test"', { cwd: varRepoDir });
|
||||
execSync('echo "hello" > file.txt', { cwd: varRepoDir });
|
||||
execSync("git add .", { cwd: varRepoDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'initial'", { cwd: varRepoDir });
|
||||
execSync('git -c commit.gpgsign=false commit -m "initial"', { cwd: varRepoDir });
|
||||
|
||||
const result = await createWorktree({
|
||||
branchName: "main",
|
||||
@@ -163,19 +163,19 @@ describe("createWorktree", () => {
|
||||
execSync("git push -u origin main", { cwd: repoDir });
|
||||
|
||||
execSync(`git clone ${remoteDir} ${remoteCloneDir}`);
|
||||
execSync("git config user.email 'test@test.com'", { cwd: remoteCloneDir });
|
||||
execSync("git config user.name 'Test'", { cwd: remoteCloneDir });
|
||||
execSync('git config user.email "test@test.com"', { cwd: remoteCloneDir });
|
||||
execSync('git config user.name "Test"', { cwd: remoteCloneDir });
|
||||
execSync("git checkout -B main origin/main", { cwd: remoteCloneDir });
|
||||
writeFileSync(join(remoteCloneDir, "file.txt"), "from-origin\n");
|
||||
execSync("git add file.txt", { cwd: remoteCloneDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'advance origin main'", {
|
||||
execSync('git -c commit.gpgsign=false commit -m "advance origin main"', {
|
||||
cwd: remoteCloneDir,
|
||||
});
|
||||
execSync("git push origin main", { cwd: remoteCloneDir });
|
||||
|
||||
writeFileSync(join(repoDir, "file.txt"), "from-local\n");
|
||||
execSync("git add file.txt", { cwd: repoDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'advance local main'", { cwd: repoDir });
|
||||
execSync('git -c commit.gpgsign=false commit -m "advance local main"', { cwd: repoDir });
|
||||
|
||||
execSync("git fetch origin", { cwd: repoDir });
|
||||
|
||||
@@ -194,7 +194,7 @@ describe("createWorktree", () => {
|
||||
it("falls back to local {branch} when origin/{branch} does not exist", async () => {
|
||||
writeFileSync(join(repoDir, "file.txt"), "from-local-only\n");
|
||||
execSync("git add file.txt", { cwd: repoDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'advance local main only'", { cwd: repoDir });
|
||||
execSync('git -c commit.gpgsign=false commit -m "advance local main only"', { cwd: repoDir });
|
||||
|
||||
const result = await createWorktree({
|
||||
branchName: "prefer-local-fallback-feature",
|
||||
@@ -286,7 +286,7 @@ describe("createWorktree", () => {
|
||||
},
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync("git add paseo.json && git -c commit.gpgsign=false commit -m 'add paseo.json'", {
|
||||
execSync('git add paseo.json && git -c commit.gpgsign=false commit -m "add paseo.json"', {
|
||||
cwd: repoDir,
|
||||
});
|
||||
|
||||
@@ -320,7 +320,7 @@ describe("createWorktree", () => {
|
||||
},
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync("git add paseo.json && git -c commit.gpgsign=false commit -m 'add paseo.json'", {
|
||||
execSync('git add paseo.json && git -c commit.gpgsign=false commit -m "add paseo.json"', {
|
||||
cwd: repoDir,
|
||||
});
|
||||
|
||||
@@ -344,7 +344,7 @@ describe("createWorktree", () => {
|
||||
},
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync("git add paseo.json && git -c commit.gpgsign=false commit -m 'add streaming setup'", {
|
||||
execSync('git add paseo.json && git -c commit.gpgsign=false commit -m "add streaming setup"', {
|
||||
cwd: repoDir,
|
||||
});
|
||||
|
||||
@@ -434,7 +434,7 @@ describe("createWorktree", () => {
|
||||
},
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync("git add paseo.json && git -c commit.gpgsign=false commit -m 'add paseo.json'", {
|
||||
execSync('git add paseo.json && git -c commit.gpgsign=false commit -m "add paseo.json"', {
|
||||
cwd: repoDir,
|
||||
});
|
||||
|
||||
@@ -504,11 +504,11 @@ describe("paseo worktree manager", () => {
|
||||
|
||||
mkdirSync(repoDir, { recursive: true });
|
||||
execSync("git init -b main", { cwd: repoDir });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: repoDir });
|
||||
execSync("git config user.name 'Test'", { cwd: repoDir });
|
||||
execSync("echo 'hello' > file.txt", { cwd: repoDir });
|
||||
execSync('git config user.email "test@test.com"', { cwd: repoDir });
|
||||
execSync('git config user.name "Test"', { cwd: repoDir });
|
||||
execSync('echo "hello" > file.txt', { cwd: repoDir });
|
||||
execSync("git add .", { cwd: repoDir });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'initial'", { cwd: repoDir });
|
||||
execSync('git -c commit.gpgsign=false commit -m "initial"', { cwd: repoDir });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -522,11 +522,11 @@ describe("paseo worktree manager", () => {
|
||||
for (const repo of [repoA, repoB]) {
|
||||
mkdirSync(repo, { recursive: true });
|
||||
execSync("git init -b main", { cwd: repo });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: repo });
|
||||
execSync("git config user.name 'Test'", { cwd: repo });
|
||||
execSync("echo 'hello' > file.txt", { cwd: repo });
|
||||
execSync('git config user.email "test@test.com"', { cwd: repo });
|
||||
execSync('git config user.name "Test"', { cwd: repo });
|
||||
execSync('echo "hello" > file.txt', { cwd: repo });
|
||||
execSync("git add .", { cwd: repo });
|
||||
execSync("git -c commit.gpgsign=false commit -m 'initial'", { cwd: repo });
|
||||
execSync('git -c commit.gpgsign=false commit -m "initial"', { cwd: repo });
|
||||
}
|
||||
|
||||
const fromRepoA = await createWorktree({
|
||||
@@ -615,7 +615,7 @@ describe("paseo worktree manager", () => {
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync(
|
||||
"git add paseo.json && git -c commit.gpgsign=false commit -m 'add teardown commands'",
|
||||
'git add paseo.json && git -c commit.gpgsign=false commit -m "add teardown commands"',
|
||||
{
|
||||
cwd: repoDir,
|
||||
},
|
||||
@@ -654,7 +654,7 @@ describe("paseo worktree manager", () => {
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync(
|
||||
"git add paseo.json && git -c commit.gpgsign=false commit -m 'add teardown port logging'",
|
||||
'git add paseo.json && git -c commit.gpgsign=false commit -m "add teardown port logging"',
|
||||
{ cwd: repoDir },
|
||||
);
|
||||
|
||||
@@ -683,7 +683,7 @@ describe("paseo worktree manager", () => {
|
||||
};
|
||||
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
|
||||
execSync(
|
||||
"git add paseo.json && git -c commit.gpgsign=false commit -m 'add failing teardown commands'",
|
||||
'git add paseo.json && git -c commit.gpgsign=false commit -m "add failing teardown commands"',
|
||||
{ cwd: repoDir },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user