loadTypescript wires up a tiny end-to-end pipeline against testdata/array so the import mutations have a real serialization path to flow through. Each test gets its own Typescript instance because Serialize is one-shot.
(t *testing.T)
| 18 | // so the import mutations have a real serialization path to flow through. |
| 19 | // Each test gets its own Typescript instance because Serialize is one-shot. |
| 20 | func loadTypescript(t *testing.T) *guts.Typescript { |
| 21 | t.Helper() |
| 22 | gen, err := guts.NewGolangParser() |
| 23 | require.NoError(t, err, "new convert") |
| 24 | |
| 25 | dir := filepath.Join(".", "testdata", "array") |
| 26 | err = gen.IncludeGenerate("./" + dir) |
| 27 | require.NoErrorf(t, err, "include %q", dir) |
| 28 | |
| 29 | gen.IncludeCustomDeclaration(config.StandardMappings()) |
| 30 | |
| 31 | ts, err := gen.ToTypescript() |
| 32 | require.NoError(t, err, "to typescript") |
| 33 | return ts |
| 34 | } |
| 35 | |
| 36 | // importBlock returns just the prefix before the first declaration, which is |
| 37 | // where Serialize emits the merged imports. |
no test coverage detected
searching dependent graphs…