|
1 |
| -import type { TargetPlainObject, TestCaseFixture, TestCaseSnapshot } from "@cursorless/common"; |
| 1 | +import type { TestCaseFixture, TestCaseSnapshot } from "@cursorless/common"; |
2 | 2 | import { generateHtml } from "./generateHtml";
|
3 | 3 | import type { BundledLanguage } from "shiki";
|
4 | 4 |
|
5 |
| -async function safeGenerateHtml({ |
6 |
| - stateName, |
7 |
| - state, |
8 |
| - languageId, |
9 |
| - command, |
10 |
| - ide, |
11 |
| - thatMarkFinalState |
12 |
| -}: { |
13 |
| - stateName: string; |
14 |
| - state: TestCaseSnapshot; |
15 |
| - languageId: BundledLanguage; |
16 |
| - command?: any; // Replace `any` with the appropriate type if known |
17 |
| - ide?: any; // Replace `any` with the appropriate type if known |
18 |
| - thatMarkFinalState?: TargetPlainObject |
19 |
| -}) { |
20 |
| - console.log("✨" + stateName + "✨"); |
21 |
| - try { |
22 |
| - const genObj = { stateName, state, languageId, command, ide } |
23 |
| - return await generateHtml(genObj); |
24 |
| - } catch (e) { |
25 |
| - console.error("error in state", stateName, e); |
26 |
| - console.error(JSON.stringify(state, null, 2)); |
27 |
| - throw e; |
28 |
| - } |
29 |
| -} |
30 |
| - |
31 |
| -interface loadFixtureProps extends TestCaseFixture { |
| 5 | +interface loadFixtureProps extends DataFixture { |
32 | 6 | filename: string;
|
33 | 7 | languageId: BundledLanguage;
|
34 | 8 | initialState: TestCaseSnapshot;
|
35 | 9 | finalState: TestCaseSnapshot;
|
36 | 10 | }
|
37 | 11 |
|
| 12 | +type StepType = { stepName: "initialState" | "middleState" | "finalState" } |
| 13 | +export type DataFixture = TestCaseFixture & StepType |
| 14 | + |
38 | 15 | export async function loadTestCaseFixture(data: loadFixtureProps) {
|
39 | 16 | try {
|
40 | 17 | const before = await getBefore({
|
|
0 commit comments