initial commit
This commit is contained in:
26
src/profiles.test.ts
Normal file
26
src/profiles.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { resolveProfileForPath } from "./profiles.ts";
|
||||
|
||||
test("resolveProfileForPath finds the first matching profile and nearest workspace root", () => {
|
||||
const result = resolveProfileForPath(
|
||||
{
|
||||
defaults: {},
|
||||
profiles: [
|
||||
{
|
||||
name: "typescript",
|
||||
match: ["src/**/*.ts"],
|
||||
workspaceRootMarkers: ["package.json", "tsconfig.json"],
|
||||
formatter: { kind: "command", command: ["biome", "format", "--write", "{file}"] },
|
||||
diagnostics: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
"/repo/src/app.ts",
|
||||
"/repo",
|
||||
["/repo/package.json", "/repo/src/app.ts"],
|
||||
);
|
||||
|
||||
assert.equal(result?.profile.name, "typescript");
|
||||
assert.equal(result?.workspaceRoot, "/repo");
|
||||
});
|
||||
Reference in New Issue
Block a user