mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
23 lines
701 B
TypeScript
23 lines
701 B
TypeScript
import { expect } from "vitest";
|
|
|
|
import { historicalSourceGraphSchema } from "../../../src/domain/referenceSourceGraph.js";
|
|
import type { TestCli } from "./cliFixture.js";
|
|
|
|
/** Import a reference source tree with the caller's chosen test home. */
|
|
export const importReferenceSourceGraph = async (
|
|
cli: TestCli,
|
|
root: string,
|
|
config: string,
|
|
) => {
|
|
const result = await cli.run({
|
|
arguments: ["import-reference-source", root, "--json"],
|
|
environment: {
|
|
HOME: config,
|
|
XDG_CONFIG_HOME: config,
|
|
XDG_CACHE_HOME: config,
|
|
},
|
|
});
|
|
expect(result.exitCode, result.stderr + JSON.stringify(result.json)).toBe(0);
|
|
return historicalSourceGraphSchema.parse(result.json);
|
|
};
|