'initial commit'

This commit is contained in:
mitchellhamilton
2019-09-16 17:18:53 +10:00
parent 8db2bfe48d
commit 2a6d43cef5
7 changed files with 154 additions and 52 deletions
+27 -1
View File
@@ -1,4 +1,8 @@
import { getChangelogEntry, BumpLevels } from "./utils";
import { getChangelogEntry, BumpLevels, getChangedPackages } from "./utils";
import tempy from "tempy";
import { exec } from "@actions/exec";
import * as fs from "fs-extra";
import path from "path";
let changelog = `# @keystone-alpha/email
@@ -78,3 +82,25 @@ test("it works", () => {
expect(entry.content).toMatchSnapshot();
expect(entry.highestLevel).toBe(BumpLevels.patch);
});
test("getChangedPackages works", async () => {
let dir = tempy.directory();
await exec("git", ["init"], { cwd: dir });
await fs.writeJson(path.join(dir, "package.json"), {
name: "some-package",
version: "1.0.0"
});
await exec("git", ["add", "."]);
await exec("git", ["commit", "-m", "'initial commit'"]);
let emptyWorkspaces = await getChangedPackages(dir);
expect(emptyWorkspaces).toEqual([]);
let workspace = {
name: "some-package",
version: "2.0.0"
};
await fs.writeJson(path.join(dir, "package.json"), workspace);
let workspaces = await getChangedPackages(dir);
expect(workspaces).toEqual([
{ name: "some-package", dir, config: workspace }
]);
});