/** * A sync redraws a JSX tag when a module its import is read through changes. * * A tag imported from a module of the project renders what that module * exports under the name, through an `index` that forwards it — outline's * `Sidebar/index.ts` is `import Sidebar from './App'; export default * Sidebar` — and past a wrapper around it (`export default * observer(AppSidebar)`). So the tag's edge depends on files that hold no * markup and no synthesized edge of their own: rewiring the index, or the * default export behind it, must redraw the tag, as a fresh index would draw * it, though the file that renders the tag is untouched. * * Every case compares the synced graph with a fresh index of the same files in * a folder of its own: indexing again over an existing index skips its * unchanged files, so it is no stand-in for one. */ import { describe, it, expect, afterEach } from 'vitest'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import CodeGraph from '../src/index'; type Files = Record; const pkg = JSON.stringify({ name: 'app', dependencies: { react: '^18', 'mobx-react': '^9' } }); /** Two pages that render `` through the same forwarding index. */ const BASE: Files = { 'package.json': pkg, 'src/components/Sidebar/Aside.tsx': 'export function Sidebar() {\n return