# test.govlab/code-parse/core/resolvers/shell.resolver.test.ts

> 19 lines of code and 0 definitions.

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

Listed in [test.govlab/code-parse/core/resolvers](https://banes-lab.com/api/source/testing/test.govlab/code-parse/core/resolvers.md), after [test.govlab/code-parse/core/resolvers/grammar.resolver.test.ts](https://banes-lab.com/source/testing/test.govlab/code-parse/core/resolvers/grammar.resolver.test.ts.md).

## Contained in

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

## Source

```typescript
import {
    WINDOWS,
    WINDOWS_SHELL,
    WINDOWS_SHELL_FLAGS,
} from "@govlab/code-parse/configuration/constants/shell.constants.ts";
import { describe, expect, it } from "vitest";
import { invocationFor } from "@govlab/code-parse/core/resolvers/shell.resolver.ts";

describe("invocationFor", () => {
    it("routes through the command interpreter on Windows, where a package binary is a batch shim the loader refuses to spawn directly", () => {
        const invocation = invocationFor(WINDOWS, "npm", ["pack", "tree-sitter-json"]);
        expect(invocation.file).toBe(WINDOWS_SHELL);
        expect(invocation.args).toEqual([...WINDOWS_SHELL_FLAGS, "npm", "pack", "tree-sitter-json"]);
    });

    it("spawns the binary directly with its arguments everywhere else", () => {
        for (const platform of ["linux", "darwin", "freebsd"]) {
            expect(invocationFor(platform, "npm", ["pack"])).toEqual({ args: ["pack"], file: "npm" });
        }
    });
});
```
