diff options
Diffstat (limited to 'packages/turbo-ignore/__tests__/getWorkspace.test.ts')
| -rw-r--r-- | packages/turbo-ignore/__tests__/getWorkspace.test.ts | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/packages/turbo-ignore/__tests__/getWorkspace.test.ts b/packages/turbo-ignore/__tests__/getWorkspace.test.ts deleted file mode 100644 index 6d97fe2..0000000 --- a/packages/turbo-ignore/__tests__/getWorkspace.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { getWorkspace } from "../src/getWorkspace"; -import { spyConsole, validateLogs } from "@turbo/test-utils"; - -describe("getWorkspace()", () => { - const mockConsole = spyConsole(); - it("getWorkspace returns workspace from arg", async () => { - expect( - getWorkspace({ - workspace: "test-workspace", - }) - ).toEqual("test-workspace"); - validateLogs( - ['Using "test-workspace" as workspace from arguments'], - mockConsole.log, - { prefix: "≫ " } - ); - }); - - it("getWorkspace returns workspace from package.json", async () => { - expect( - getWorkspace({ - directory: "./__fixtures__/app", - }) - ).toEqual("test-app"); - expect(mockConsole.log).toHaveBeenCalledWith( - "≫ ", - 'Inferred "test-app" as workspace from "package.json"' - ); - }); - - it("getWorkspace used current directory if not specified", async () => { - expect(getWorkspace({})).toEqual("turbo-ignore"); - expect(mockConsole.log).toHaveBeenCalledWith( - "≫ ", - 'Inferred "turbo-ignore" as workspace from "package.json"' - ); - }); - - it("getWorkspace returns null when no arg is provided and package.json is missing name field", async () => { - expect( - getWorkspace({ - directory: "./__fixtures__/invalid-app", - }) - ).toEqual(null); - expect(mockConsole.error).toHaveBeenCalledWith( - "≫ ", - '"__fixtures__/invalid-app/package.json" is missing the "name" field (required).' - ); - }); - - it("getWorkspace returns null when no arg is provided and package.json can be found", async () => { - expect( - getWorkspace({ - directory: "./__fixtures__/no-app", - }) - ).toEqual(null); - expect(mockConsole.error).toHaveBeenCalledWith( - "≫ ", - '"__fixtures__/no-app/package.json" could not be found. turbo-ignore inferencing failed' - ); - }); -}); |