()
| 26 | // helpers |
| 27 | |
| 28 | function createMockData() { |
| 29 | const ast = parse( |
| 30 | ` |
| 31 | export function MyComponent() { |
| 32 | return <div>Hello world!</div>; |
| 33 | } |
| 34 | `, |
| 35 | { sourceType: "module", plugins: ["jsx"] }, |
| 36 | ); |
| 37 | |
| 38 | let testElementPath: NodePath | null = null; |
| 39 | traverse(ast, { |
| 40 | JSXElement(nodePath) { |
| 41 | testElementPath = nodePath; |
| 42 | }, |
| 43 | }); |
| 44 | if (!testElementPath) { |
| 45 | throw new Error( |
| 46 | "testElementPath cannot be null - check test case definition", |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | const testElementKey = `0/declaration/body/0/argument`; |
| 51 | |
| 52 | return { |
| 53 | ast, |
| 54 | testElementPath, |
| 55 | testElementKey, |
| 56 | }; |
| 57 | } |
no test coverage detected