mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
'initial commit'
This commit is contained in:
+27
-1
@@ -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 }
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user