MCPcopy Index your code
hub / github.com/TanStack/devtools / testTransform

Function testTransform

packages/devtools-vite/src/inject-plugin.test.ts:13–38  ·  view source on GitHub ↗
(
  code: string,
  packageName: string,
  pluginName: string,
  pluginImport: {
    importName: string
    type: 'jsx' | 'function'
  },
)

Source from the content-addressed store, hash-verified

11
12// Helper to test transformation without file I/O
13const testTransform = (
14 code: string,
15 packageName: string,
16 pluginName: string,
17 pluginImport: {
18 importName: string
19 type: 'jsx' | 'function'
20 },
21) => {
22 const devtoolsComponentName = findDevtoolsComponentName(code)
23 if (!devtoolsComponentName) {
24 return { transformed: false, code }
25 }
26
27 const result = transformAndInject(
28 code,
29 { packageName, pluginName, pluginImport },
30 devtoolsComponentName,
31 )
32
33 if (!result?.transformed) {
34 return { transformed: false, code }
35 }
36
37 return { transformed: true, code: result.code }
38}
39
40describe('inject-plugin', () => {
41 describe('detectDevtoolsFile', () => {

Callers 1

Calls 2

transformAndInjectFunction · 0.90

Tested by

no test coverage detected