Skip to content

Commit

Permalink
test(exec/run): Explicitly test --no-sort
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Apr 24, 2019
1 parent 51625fa commit 8ccf844
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions commands/exec/__tests__/exec-command.test.js
Expand Up @@ -183,6 +183,25 @@ describe("ExecCommand", () => {
});
});

describe("with --no-sort", () => {
it("runs commands in lexical (not topological) order", async () => {
const testDir = await initFixture("toposort");

await lernaExec(testDir)("ls", "--no-sort");

expect(calledInPackages()).toEqual([
"package-cycle-1",
"package-cycle-2",
"package-cycle-extraneous",
"package-dag-1",
"package-dag-2a",
"package-dag-2b",
"package-dag-3",
"package-standalone",
]);
});
});

describe("in a cyclical repo", () => {
it("warns when cycles are encountered", async () => {
const testDir = await initFixture("toposort");
Expand Down
19 changes: 19 additions & 0 deletions commands/run/__tests__/run-command.test.js
Expand Up @@ -170,6 +170,25 @@ describe("RunCommand", () => {
});
});

describe("with --no-sort", () => {
it("runs scripts in lexical (not topological) order", async () => {
const testDir = await initFixture("toposort");

await lernaRun(testDir)("env", "--no-sort");

expect(output.logged().split("\n")).toEqual([
"package-cycle-1",
"package-cycle-2",
"package-cycle-extraneous",
"package-dag-1",
"package-dag-2a",
"package-dag-2b",
"package-dag-3",
"package-standalone",
]);
});
});

describe("in a cyclical repo", () => {
it("warns when cycles are encountered", async () => {
const testDir = await initFixture("toposort");
Expand Down

0 comments on commit 8ccf844

Please sign in to comment.