Skip to content

Commit

Permalink
test(version): Simplify version-bump assertions
Browse files Browse the repository at this point in the history
The snapshots were obscuring what was actually being tested.
  • Loading branch information
evocateur committed Apr 24, 2019
1 parent cdc5e46 commit c1aafe7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 123 deletions.
115 changes: 0 additions & 115 deletions commands/version/__tests__/__snapshots__/version-bump.test.js.snap

This file was deleted.

12 changes: 4 additions & 8 deletions commands/version/__tests__/version-bump.test.js
Expand Up @@ -14,14 +14,10 @@ const PromptUtilities = require("@lerna/prompt");
// helpers
const initFixture = require("@lerna-test/init-fixture")(path.resolve(__dirname, "../../publish/__tests__"));
const getCommitMessage = require("@lerna-test/get-commit-message");
const showCommit = require("@lerna-test/show-commit");

// test command
const lernaVersion = require("@lerna-test/command-runner")(require("../command"));

// stabilize commit SHA
expect.addSnapshotSerializer(require("@lerna-test/serialize-git-sha"));

describe("version bump", () => {
it("accepts explicit versions", async () => {
const testDir = await initFixture("normal");
Expand Down Expand Up @@ -111,16 +107,16 @@ describe("version bump", () => {

await lernaVersion(testDir)("prerelease");

const patch = await showCommit(testDir);
expect(patch).toMatchSnapshot();
const message = await getCommitMessage(testDir);
expect(message).toContain("package-1@1.0.1-alpha.0");
});

test("prerelease increments version with custom --preid", async () => {
const testDir = await initFixture("independent");

await lernaVersion(testDir)("prerelease", "--preid", "foo");

const patch = await showCommit(testDir);
expect(patch).toMatchSnapshot();
const message = await getCommitMessage(testDir);
expect(message).toContain("package-1@1.0.1-foo.0");
});
});

0 comments on commit c1aafe7

Please sign in to comment.