MCPcopy Create free account
hub / github.com/coder/guts / loadTypescript

Function loadTypescript

imports_test.go:20–34  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
20func 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.

Calls 5

NewGolangParserFunction · 0.92
StandardMappingsFunction · 0.92
IncludeGenerateMethod · 0.80
ToTypescriptMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…