Skip to content

Commit 30114ff

Browse files
Updated all the "git push" tests for v5.0
1 parent e710f2f commit 30114ff

1 file changed

Lines changed: 50 additions & 13 deletions

File tree

test/specs/git-push.spec.js

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,49 @@
33
const { check, files, mocks, bump } = require("../utils");
44
const { expect } = require("chai");
55

6-
describe.skip("bump --push", () => {
6+
describe("bump --push", () => {
7+
8+
it("should not push by default", () => {
9+
files.create("package.json", { version: "1.0.0" });
10+
11+
let cli = bump("major");
12+
13+
expect(cli).to.have.stderr("");
14+
expect(cli).to.have.exitCode(0);
15+
16+
expect(cli).to.have.stdout(
17+
`${check} Updated package.json to 2.0.0\n`
18+
);
19+
20+
let git = mocks.git();
21+
expect(git.length).to.equal(0);
22+
});
23+
24+
it("should not push by default, even if --commit or --tag is used", () => {
25+
files.create("package.json", { version: "1.0.0" });
26+
27+
let cli = bump("major --commit --tag");
28+
29+
expect(cli).to.have.stderr("");
30+
expect(cli).to.have.exitCode(0);
31+
32+
expect(cli).to.have.stdout(
33+
`${check} Updated package.json to 2.0.0\n` +
34+
`${check} Git commit\n` +
35+
`${check} Git tag\n`
36+
);
37+
38+
let git = mocks.git();
39+
expect(git.length).to.equal(2);
40+
41+
expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json');
42+
expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0" v2.0.0');
43+
});
744

845
it("should commit and push to git", () => {
946
files.create("package.json", { version: "1.0.0" });
1047

11-
let cli = bump("--major --push");
48+
let cli = bump("major --push");
1249

1350
expect(cli).to.have.stderr("");
1451
expect(cli).to.have.exitCode(0);
@@ -22,14 +59,14 @@ describe.skip("bump --push", () => {
2259
let git = mocks.git();
2360
expect(git.length).to.equal(2);
2461

25-
expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0"');
26-
expect(git[1].cmd).to.equal("git push");
62+
expect(git[0]).to.equal('git commit --message "release v2.0.0" package.json');
63+
expect(git[1]).to.equal("git push");
2764
});
2865

2966
it("should push all files", () => {
3067
files.create("package.json", { version: "1.0.0" });
3168

32-
let cli = bump("--minor --push --all");
69+
let cli = bump("minor --push --all");
3370

3471
expect(cli).to.have.stderr("");
3572
expect(cli).to.have.exitCode(0);
@@ -43,20 +80,20 @@ describe.skip("bump --push", () => {
4380
let git = mocks.git();
4481
expect(git.length).to.equal(2);
4582

46-
expect(git[0].cmd).to.equal('git commit -a -m "release v1.1.0"');
47-
expect(git[1].cmd).to.equal("git push");
83+
expect(git[0]).to.equal('git commit --all --message "release v1.1.0"');
84+
expect(git[1]).to.equal("git push");
4885
});
4986

5087
it("should push git tags", () => {
5188
files.create("package.json", { version: "1.0.0" });
5289

53-
let cli = bump("--premajor --tag --push");
90+
let cli = bump("premajor --tag --push");
5491

5592
expect(cli).to.have.stderr("");
5693
expect(cli).to.have.exitCode(0);
5794

5895
expect(cli).to.have.stdout(
59-
`${check} Updated package.json to 2.0.0-beta.0\n` +
96+
`${check} Updated package.json to 2.0.0-beta.1\n` +
6097
`${check} Git commit\n` +
6198
`${check} Git tag\n` +
6299
`${check} Git push\n`
@@ -65,9 +102,9 @@ describe.skip("bump --push", () => {
65102
let git = mocks.git();
66103
expect(git.length).to.equal(4);
67104

68-
expect(git[0].cmd).to.equal('git commit package.json -m "release v2.0.0-beta.0"');
69-
expect(git[1].cmd).to.equal("git tag -a v2.0.0-beta.0 -m 2.0.0-beta.0");
70-
expect(git[2].cmd).to.equal("git push");
71-
expect(git[3].cmd).to.equal("git push --tags");
105+
expect(git[0]).to.equal('git commit --message "release v2.0.0-beta.1" package.json');
106+
expect(git[1]).to.equal('git tag --annotate --message "release v2.0.0-beta.1" v2.0.0-beta.1');
107+
expect(git[2]).to.equal("git push");
108+
expect(git[3]).to.equal("git push --tags");
72109
});
73110
});

0 commit comments

Comments
 (0)