Skip to content

Commit

Permalink
test: master -> main
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Nov 9, 2020
1 parent 5ef6364 commit d579129
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 67 deletions.
6 changes: 3 additions & 3 deletions commands/import/__tests__/import-command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ describe("ImportCommand", () => {
await gitAdd(externalDir, conflictedFileName);
await gitCommit(externalDir, "branch content written");

await execa("git", ["checkout", "master"], { cwd: externalDir });
await execa("git", ["checkout", "main"], { cwd: externalDir });

await fs.writeFile(conflictedFile, "master content");
await fs.writeFile(conflictedFile, "main content");
await gitAdd(externalDir, conflictedFileName);
await gitCommit(externalDir, "master content written");
await gitCommit(externalDir, "main content written");

try {
await execa("git", ["merge", branchName], { cwd: externalDir });
Expand Down
2 changes: 1 addition & 1 deletion commands/publish/__tests__/publish-command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("PublishCommand", () => {
});

it("exits non-zero with --since", async () => {
const command = lernaPublish(cwd)("--since", "master");
const command = lernaPublish(cwd)("--since", "main");

await expect(command).rejects.toThrow(
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`version patch with previous prerelease also graduates prereleased 1`] = `
v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -41,7 +41,7 @@ index SHA..SHA 100644
exports[`version prerelease with immediate graduation 1`] = `
v1.0.1-beta.4
HEAD -> master, tag: v1.0.1-beta.4
HEAD -> main, tag: v1.0.1-beta.4
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -69,7 +69,7 @@ index SHA..SHA 100644
exports[`version prerelease with immediate graduation 2`] = `
v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -130,7 +130,7 @@ index SHA..SHA 100644
exports[`version prerelease with previous prerelease bumps changed only 1`] = `
v1.0.1-beta.4
HEAD -> master, tag: v1.0.1-beta.4
HEAD -> main, tag: v1.0.1-beta.4
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand All @@ -151,7 +151,7 @@ index SHA..SHA 100644
exports[`version prerelease with previous prerelease supersedes --conventional-commits 1`] = `
v1.0.1-beta.4
HEAD -> master, tag: v1.0.1-beta.4
HEAD -> main, tag: v1.0.1-beta.4
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`VersionCommand --exact updates existing exact versions 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -61,7 +61,7 @@ index SHA..SHA 100644
exports[`VersionCommand --exact updates matching local dependencies of published packages with exact versions 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -129,7 +129,7 @@ Object {
exports[`VersionCommand --no-push versions changed packages without git push 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -196,7 +196,7 @@ exports[`VersionCommand independent mode versions changed packages: commit 1`] =
- [email protected]
- [email protected]
HEAD -> master, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
HEAD -> main, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
diff --git a/packages/package-1/package.json b/packages/package-1/package.json
index SHA..SHA 100644
Expand Down Expand Up @@ -265,7 +265,7 @@ Object {
exports[`VersionCommand normal mode bumps all packages when major version selected 1`] = `
"v2.0.0
HEAD -> master, tag: v2.0.0
HEAD -> main, tag: v2.0.0
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -326,7 +326,7 @@ index SHA..SHA 100644
exports[`VersionCommand normal mode only bumps changed packages when non-major version selected 1`] = `
"v1.1.0
HEAD -> master, tag: v1.1.0
HEAD -> main, tag: v1.1.0
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand All @@ -347,7 +347,7 @@ index SHA..SHA 100644
exports[`VersionCommand normal mode versions changed packages: commit 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down Expand Up @@ -470,7 +470,7 @@ Array [
exports[`VersionCommand versions all transitive dependents after change 1`] = `
"v2.0.0
HEAD -> master, tag: v2.0.0
HEAD -> main, tag: v2.0.0
diff --git a/lerna.json b/lerna.json
index SHA..SHA 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`--conventional-commits fixed mode should guess prerelease version bumps and generate CHANGELOG 1`] = `
"v2.0.0-alpha.0
HEAD -> master, tag: v2.0.0-alpha.0
HEAD -> main, tag: v2.0.0-alpha.0
CHANGELOG.md
lerna.json
Expand All @@ -22,7 +22,7 @@ packages/package-5/package.json"
exports[`--conventional-commits fixed mode should use conventional-commits utility to guess version bump and generate CHANGELOG 1`] = `
"v2.0.0
HEAD -> master, tag: v2.0.0
HEAD -> main, tag: v2.0.0
CHANGELOG.md
lerna.json
Expand All @@ -47,7 +47,7 @@ exports[`--conventional-commits independent should graduate prerelease version b
- [email protected]
- [email protected]
HEAD -> master, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
HEAD -> main, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
packages/package-1/CHANGELOG.md
packages/package-1/package.json
Expand All @@ -70,7 +70,7 @@ exports[`--conventional-commits independent should guess prerelease version bump
- [email protected]
- [email protected]
HEAD -> master, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
HEAD -> main, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
packages/package-1/CHANGELOG.md
packages/package-1/package.json
Expand All @@ -93,7 +93,7 @@ exports[`--conventional-commits independent should use conventional-commits util
- [email protected]
- [email protected]
HEAD -> master, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
HEAD -> main, tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected], tag: [email protected]
packages/package-1/CHANGELOG.md
packages/package-1/package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`version --ignore-changes does not version packages with ignored changes 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
lerna.json
packages/package-4/package.json"
Expand All @@ -12,7 +12,7 @@ packages/package-4/package.json"
exports[`version --ignore-changes is mapped from deprecated --ignore 1`] = `
"v1.0.1
HEAD -> master, tag: v1.0.1
HEAD -> main, tag: v1.0.1
lerna.json
packages/package-4/package.json"
Expand Down
2 changes: 1 addition & 1 deletion commands/version/__tests__/get-current-branch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getCurrentBranch = require("../lib/get-current-branch");
test("getCurrentBranch", async () => {
const cwd = await initFixture("root-manifest-only");

expect(getCurrentBranch({ cwd })).toBe("master");
expect(getCurrentBranch({ cwd })).toBe("main");
});

test("getCurrentBranch without commit", async () => {
Expand Down
24 changes: 12 additions & 12 deletions commands/version/__tests__/git-push.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ test("gitPush", async () => {
await execa("git", ["tag", "[email protected]", "-m", "[email protected]"], { cwd });
await execa("git", ["tag", "[email protected]", "-m", "[email protected]"], { cwd });

await gitPush("origin", "master", { cwd });
await gitPush("origin", "main", { cwd });

expect(childProcess.exec).toHaveBeenLastCalledWith(
"git",
["push", "--follow-tags", "--no-verify", "--atomic", "origin", "master"],
["push", "--follow-tags", "--no-verify", "--atomic", "origin", "main"],
{ cwd }
);

Expand All @@ -50,7 +50,7 @@ test("remote that does not support --atomic", async () => {
childProcess.exec.mockImplementationOnce(async () => {
const stderr = "fatal: the receiving end does not support --atomic push";
const error = new Error(
["Command failed: git push --follow-tags --atomic --no-verify origin master", stderr].join("\n")
["Command failed: git push --follow-tags --atomic --no-verify origin main", stderr].join("\n")
);

error.stderr = stderr;
Expand All @@ -59,12 +59,12 @@ test("remote that does not support --atomic", async () => {
});

// this call should _not_ throw
await gitPush("origin", "master", { cwd });
await gitPush("origin", "main", { cwd });

expect(childProcess.exec).toHaveBeenCalledTimes(2);
expect(childProcess.exec).toHaveBeenLastCalledWith(
"git",
["push", "--follow-tags", "--no-verify", "origin", "master"],
["push", "--follow-tags", "--no-verify", "origin", "main"],
{ cwd }
);

Expand All @@ -84,7 +84,7 @@ test("remote that does not support --atomic and git stderr redirected to stdout
childProcess.exec.mockImplementationOnce(async () => {
const stdout = "fatal: the receiving end does not support --atomic push";
const error = new Error(
["Command failed: git push --follow-tags --atomic --no-verify origin master", stdout].join("\n")
["Command failed: git push --follow-tags --atomic --no-verify origin main", stdout].join("\n")
);

error.stdout = stdout;
Expand All @@ -93,12 +93,12 @@ test("remote that does not support --atomic and git stderr redirected to stdout
});

// this call should _not_ throw
await gitPush("origin", "master", { cwd });
await gitPush("origin", "main", { cwd });

expect(childProcess.exec).toHaveBeenCalledTimes(2);
expect(childProcess.exec).toHaveBeenLastCalledWith(
"git",
["push", "--follow-tags", "--no-verify", "origin", "master"],
["push", "--follow-tags", "--no-verify", "origin", "main"],
{ cwd }
);

Expand All @@ -116,15 +116,15 @@ test("git cli that does not support --atomic", async () => {
childProcess.exec.mockImplementationOnce(async () => {
const stderr = "error: unknown option `atomic'";
const error = new Error(
["Command failed: git push --follow-tags --atomic --no-verify origin master", stderr].join("\n")
["Command failed: git push --follow-tags --atomic --no-verify origin main", stderr].join("\n")
);

error.stderr = stderr;

throw error;
});

await gitPush("origin", "master", { cwd });
await gitPush("origin", "main", { cwd });

await expect(listRemoteTags(cwd)).resolves.toMatch("v7.8.9");
});
Expand All @@ -135,13 +135,13 @@ test("unexpected git error", async () => {
childProcess.exec.mockImplementationOnce(async () => {
const stderr = "fatal: some unexpected error";
const error = new Error(
["Command failed: git push --follow-tags --atomic --no-verify origin master", stderr].join("\n")
["Command failed: git push --follow-tags --atomic --no-verify origin main", stderr].join("\n")
);

error.stderr = stderr;

throw error;
});

await expect(gitPush("origin", "master", { cwd })).rejects.toThrowError(/some unexpected error/);
await expect(gitPush("origin", "main", { cwd })).rejects.toThrowError(/some unexpected error/);
});
6 changes: 3 additions & 3 deletions commands/version/__tests__/is-behind-upstream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const isBehindUpstream = require("../lib/is-behind-upstream");
test("isBehindUpstream", async () => {
const { cwd } = await cloneFixture("root-manifest-only");

expect(isBehindUpstream("origin", "master", { cwd })).toBe(false);
expect(isBehindUpstream("origin", "main", { cwd })).toBe(false);

await execa("git", ["commit", "--allow-empty", "-m", "change"], { cwd });
await execa("git", ["push", "origin", "master"], { cwd });
await execa("git", ["push", "origin", "main"], { cwd });
await execa("git", ["reset", "--hard", "HEAD^"], { cwd });

expect(isBehindUpstream("origin", "master", { cwd })).toBe(true);
expect(isBehindUpstream("origin", "main", { cwd })).toBe(true);
});
4 changes: 2 additions & 2 deletions commands/version/__tests__/version-allow-branch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("version --allow-branch", () => {
const testDir = await initFixture("normal");

await changeBranch(testDir, "unmatched");
const command = lernaVersion(testDir)("--allow-branch", "master");
const command = lernaVersion(testDir)("--allow-branch", "main");

await expect(command).rejects.toThrow("Branch 'unmatched' is restricted from versioning");
});
Expand All @@ -53,7 +53,7 @@ describe("version --allow-branch", () => {
const testDir = await initFixture("normal");

await changeBranch(testDir, "feature/awesome");
const result = await lernaVersion(testDir)("--allow-branch", "master", "feature/*");
const result = await lernaVersion(testDir)("--allow-branch", "main", "feature/*");

expect(result.updates).toHaveLength(5);
});
Expand Down
2 changes: 1 addition & 1 deletion commands/version/__tests__/version-bump-prerelease.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ test("independent version prerelease respects --no-private", async () => {
- [email protected]
HEAD -> master, tag: [email protected]
HEAD -> main, tag: [email protected]
packages/pkg-1/package.json
`);
Expand Down
Loading

0 comments on commit d579129

Please sign in to comment.