-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
git-tag.test.js
46 lines (31 loc) · 1.31 KB
/
git-tag.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use strict";
jest.mock("@lerna/child-process");
const childProcess = require("@lerna/child-process");
const { gitTag } = require("../lib/git-tag");
describe("gitTag", () => {
childProcess.exec.mockResolvedValue();
it("creates an annotated git tag", async () => {
const tag = "v1.2.3";
const opts = { cwd: "default" };
await gitTag(tag, {}, opts);
expect(childProcess.exec).toHaveBeenLastCalledWith("git", ["tag", tag, "-m", tag], opts);
});
it("signs the tag when configured", async () => {
const tag = "v3.2.1";
const opts = { cwd: "signed" };
await gitTag(tag, { signGitTag: true }, opts);
expect(childProcess.exec).toHaveBeenLastCalledWith("git", ["tag", tag, "-m", tag, "--sign"], opts);
});
it("forces the tag when configured", async () => {
const tag = "v1.1.1";
const opts = { cwd: "forced" };
await gitTag(tag, { forceGitTag: true }, opts);
expect(childProcess.exec).toHaveBeenLastCalledWith("git", ["tag", tag, "-m", tag, "--force"], opts);
});
it("creates an annotated git tag using the wrapper arguments", async () => {
const tag = "v1.2.4";
const opts = { cwd: "default" };
await gitTag(tag, {}, opts, "git-wrapper gh-tag %s -m %s");
expect(mockExec).toHaveBeenLastCalledWith("git-wrapper", ["gh-tag", tag, "-m", tag], opts);
});
});