# test.govlab/pipeline/core/resolvers/shell.resolver.test.ts

> 17 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-pipeline-core-resolvers-shell-resolver-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/pipeline/core/resolvers/shell.resolver.test.ts.txt

Listed in [test.govlab/pipeline/core/resolvers](https://banes-lab.com/api/source/testing/test.govlab/pipeline/core/resolvers.md).

## Contained in

- [test.govlab/pipeline/core/resolvers](https://banes-lab.com/anatomy/testing/folder-testing-test-govlab-pipeline-core-resolvers.md)

## Source

```typescript
import { describe, expect, it } from "vitest";
import { shellFor } from "@govlab/pipeline/core/resolvers/shell.resolver.ts";

const WINDOWS = "win32";
const CUSTOM_PROCESSOR = "C:/Windows/System32/cmd.exe";

describe("shellFor", () => {
    it("uses the host command processor on Windows when one is declared", () => {
        expect(shellFor(WINDOWS, CUSTOM_PROCESSOR)).toStrictEqual({ flag: "/d /s /c", shell: CUSTOM_PROCESSOR });
    });

    it("falls back to the conventional processor on Windows when none is declared", () => {
        expect(shellFor(WINDOWS).shell).toBe("cmd.exe");
    });

    it("uses a posix shell on every other platform and ignores any command processor", () => {
        for (const platform of ["linux", "darwin", "freebsd"]) {
            expect(shellFor(platform, CUSTOM_PROCESSOR)).toStrictEqual({ flag: "-c", shell: "/bin/sh" });
        }
    });
});
```
