diff --git a/src/commands/ExecCommand.js b/src/commands/ExecCommand.js index e72dc19d92..9cff33b047 100644 --- a/src/commands/ExecCommand.js +++ b/src/commands/ExecCommand.js @@ -1,7 +1,6 @@ import async from "async"; import ChildProcessUtilities from "../ChildProcessUtilities"; - import Command from "../Command"; import PackageUtilities from "../PackageUtilities"; import UpdatedPackagesCollector from "../UpdatedPackagesCollector"; @@ -16,8 +15,9 @@ export const describe = "Run an arbitrary command in each package."; export const builder = { "only-updated": { - "describe": "When executing scripts/commands, only run the script/command on packages which " - + "have been updated since the last release" + group: "Command Options:", + describe: "Run command in packages that have been updated since the last release only", + type: "boolean", }, "parallel": { group: "Command Options:", diff --git a/src/commands/RunCommand.js b/src/commands/RunCommand.js index ac88364ac1..3b29722fae 100644 --- a/src/commands/RunCommand.js +++ b/src/commands/RunCommand.js @@ -21,8 +21,9 @@ export const builder = { type: "boolean", }, "only-updated": { - "describe": "When executing scripts/commands, only run the script/command on packages which " - + "have been updated since the last release" + group: "Command Options:", + describe: "Run script in packages that have been updated since the last release only", + type: "boolean", }, "parallel": { group: "Command Options:", diff --git a/test/ExecCommand.js b/test/ExecCommand.js index 403bdea9a3..1fcf2d3f50 100644 --- a/test/ExecCommand.js +++ b/test/ExecCommand.js @@ -112,12 +112,13 @@ describe("ExecCommand", () => { })); }); - it("should filter packages that are not updated when onlyUpdate", (done) => { - - UpdatedPackagesCollector.prototype.getUpdates = jest.fn(() => [{ package: { - name: "package-2", - location: path.join(testDir, "packages/package-2") - } }]); + it("should filter packages that are not updated with --only-updated", (done) => { + UpdatedPackagesCollector.prototype.getUpdates = jest.fn(() => [{ + package: { + name: "package-2", + location: path.join(testDir, "packages/package-2"), + }, + }]); const execCommand = new ExecCommand(["ls"], { onlyUpdated: true, diff --git a/test/PackageUtilities.js b/test/PackageUtilities.js index 1908730357..151d88337e 100644 --- a/test/PackageUtilities.js +++ b/test/PackageUtilities.js @@ -183,12 +183,11 @@ describe("PackageUtilities", () => { }); describe(".filterPackagesThatAreNotUpdated()", () => { - it("should return an empty array when there are no packages to filter", () => { const packagesToFilter = []; const packageUpdates = [ { package: { name: "ghi" } }, - { package: { name: "xyz" } } + { package: { name: "xyz" } }, ]; const updatedPackages = PackageUtilities.filterPackagesThatAreNotUpdated( packagesToFilter, @@ -230,7 +229,6 @@ describe("PackageUtilities", () => { expect(updatedPackages).toHaveLength(1); expect(updatedPackages).toEqual([{ name: "ghi" }]); }); - }); describe(".topologicallyBatchPackages()", () => { diff --git a/test/RunCommand.js b/test/RunCommand.js index 3caf7bd5e9..c9d9ecaa31 100644 --- a/test/RunCommand.js +++ b/test/RunCommand.js @@ -149,12 +149,14 @@ describe("RunCommand", () => { }); }); - it("should filter packages that are not updated when onlyUpdate", (done) => { - UpdatedPackagesCollector.prototype.getUpdates = jest.fn(() => [{ package: { - name: "package-3", - location: path.join(testDir, "packages/package-3"), - scripts: { "my-script": "echo package-3" } - } }]); + it("should filter packages that are not updated with --only-updated", (done) => { + UpdatedPackagesCollector.prototype.getUpdates = jest.fn(() => [{ + package: { + name: "package-3", + location: path.join(testDir, "packages/package-3"), + scripts: { "my-script": "echo package-3" }, + }, + }]); const runCommand = new RunCommand(["my-script"], { onlyUpdated: true, @@ -198,7 +200,6 @@ describe("RunCommand", () => { } })); }); - }); describe("with --include-filtered-dependencies", () => { @@ -231,5 +232,4 @@ describe("RunCommand", () => { })); }); }); - });