Skip to content

Commit cfe1805

Browse files
committed
test: update / add tests
1 parent 104a055 commit cfe1805

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

test/specs/api.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe("versionBup() API", () => {
2828
tag: false,
2929
updatedFiles: ["package.json"],
3030
skippedFiles: [],
31+
skippedScripts: []
3132
});
3233

3334
// The package.json file should have been updated
@@ -54,6 +55,7 @@ describe("versionBup() API", () => {
5455
tag: false,
5556
updatedFiles: ["package.json"],
5657
skippedFiles: [],
58+
skippedScripts: []
5759
});
5860

5961
// The package.json file should have been updated
@@ -98,6 +100,7 @@ describe("versionBup() API", () => {
98100
"subdir/deep/changelog.md"
99101
],
100102
skippedFiles: [],
103+
skippedScripts: []
101104
});
102105

103106
// The CWD should not have changed

test/specs/files.spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,30 @@ describe("bump [files...]", () => {
203203
expect(files.json("package.json")).to.deep.equal({ version: "1.2.3" });
204204
});
205205

206+
it("should skip specified version scripts if present", () => {
207+
files.create("package.json", {
208+
version: "1.2.3",
209+
scripts: {
210+
preversion: "echo preversion",
211+
version: "echo version",
212+
}
213+
});
214+
files.create("package-lock.json", { version: "1.2.3" });
215+
216+
let cli = bump("major --skip-version-scripts preversion postversion");
217+
218+
expect(cli).to.have.stderr("");
219+
expect(cli).to.have.exitCode(0);
220+
221+
expect(cli).to.have.stdout(
222+
`${check} Script skipped preversion\n` +
223+
`${check} Updated package.json to 2.0.0\n` +
224+
`${check} Updated package-lock.json to 2.0.0\n` +
225+
`${check} Npm run version\n`
226+
);
227+
228+
expect(files.json("package.json")).to.deep.equal({ version: "2.0.0", scripts: { preversion: "echo preversion", version: "echo version", }});
229+
expect(files.json("package-lock.json")).to.deep.equal({ version: "2.0.0" });
230+
});
231+
206232
});

0 commit comments

Comments
 (0)