(
code: string,
packageName: string,
pluginName: string,
pluginImport: {
importName: string
type: 'jsx' | 'function'
},
)
| 11 | |
| 12 | // Helper to test transformation without file I/O |
| 13 | const 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 | |
| 40 | describe('inject-plugin', () => { |
| 41 | describe('detectDevtoolsFile', () => { |
no test coverage detected