aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/turbo-ignore/__tests__/getTask.test.ts
blob: a184893e2a4c101a271095f41601a8f9f060e5c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { getTask } from "../src/getTask";
import { spyConsole, validateLogs } from "@turbo/test-utils";

describe("getWorkspace()", () => {
  const mockConsole = spyConsole();
  it("getTask defaults to build", async () => {
    expect(getTask({})).toEqual("build");
    validateLogs(
      ['Using "build" as the task as it was unspecified'],
      mockConsole.log,
      { prefix: "≫  " }
    );
  });

  it("getTask returns a quoted task if user-supplied", async () => {
    expect(
      getTask({
        task: "workspace#task",
      })
    ).toEqual(`"workspace#task"`);
    validateLogs(
      ['Using "workspace#task" as the task from the arguments'],
      mockConsole.log,
      { prefix: "≫  " }
    );
  });
});