|
| 1 | +import { test, expect } from "vitest"; |
| 2 | +import { getExecCommand } from "../utils/package-manager"; |
| 3 | + |
| 4 | +test("getExecCommand for prettier with pnpm", () => { |
| 5 | + const command = getExecCommand("pnpm", "prettier", [ |
| 6 | + "--check", |
| 7 | + "--ignore-unknown", |
| 8 | + "src", |
| 9 | + ]); |
| 10 | + expect(command).toBe("pnpm exec prettier --check --ignore-unknown src"); |
| 11 | +}); |
| 12 | + |
| 13 | +test("getExecCommand for prettier with npm", () => { |
| 14 | + const command = getExecCommand("npm", "prettier", [ |
| 15 | + "--check", |
| 16 | + "--ignore-unknown", |
| 17 | + "src", |
| 18 | + ]); |
| 19 | + expect(command).toBe("npm exec prettier -- --check --ignore-unknown src"); |
| 20 | +}); |
| 21 | + |
| 22 | +test("getExecCommand for prettier with yarn", () => { |
| 23 | + const command = getExecCommand("yarn", "prettier", [ |
| 24 | + "--check", |
| 25 | + "--ignore-unknown", |
| 26 | + "src", |
| 27 | + ]); |
| 28 | + expect(command).toBe("yarn exec prettier -- --check --ignore-unknown src"); |
| 29 | +}); |
| 30 | + |
| 31 | +test("getExecCommand for prettier with bun", () => { |
| 32 | + const command = getExecCommand("bun", "prettier", [ |
| 33 | + "--check", |
| 34 | + "--ignore-unknown", |
| 35 | + "src", |
| 36 | + ]); |
| 37 | + expect(command).toBe("bunx prettier --check --ignore-unknown src"); |
| 38 | +}); |
| 39 | + |
| 40 | +test("getExecCommand for eslint with pnpm", () => { |
| 41 | + const command = getExecCommand("pnpm", "eslint", ["--no-warn-ignore", "src"]); |
| 42 | + expect(command).toBe("pnpm exec eslint --no-warn-ignore src"); |
| 43 | +}); |
| 44 | + |
| 45 | +test("getExecCommand for eslint with npm", () => { |
| 46 | + const command = getExecCommand("npm", "eslint", ["--no-warn-ignore", "src"]); |
| 47 | + expect(command).toBe("npm exec eslint -- --no-warn-ignore src"); |
| 48 | +}); |
| 49 | +test("getExecCommand for eslint with yarn", () => { |
| 50 | + const command = getExecCommand("yarn", "eslint", ["--no-warn-ignore", "src"]); |
| 51 | + expect(command).toBe("yarn exec eslint -- --no-warn-ignore src"); |
| 52 | +}); |
| 53 | + |
| 54 | +test("getExecCommand for eslint with bun", () => { |
| 55 | + const command = getExecCommand("bun", "eslint", ["--no-warn-ignore", "src"]); |
| 56 | + expect(command).toBe("bunx eslint --no-warn-ignore src"); |
| 57 | +}); |
0 commit comments