(code: string)
| 193 | |
| 194 | describe('Import extraction regex (utils.ts line 1596 pattern)', () => { |
| 195 | const extractModules = (code: string): string[] => { |
| 196 | const results: string[] = [] |
| 197 | const re = new RegExp(IMPORT_EXTRACTION_REGEX.source, 'g') |
| 198 | let m: RegExpExecArray | null |
| 199 | while ((m = re.exec(code)) !== null) { |
| 200 | results.push(m[1] ?? m[2]) |
| 201 | } |
| 202 | return results |
| 203 | } |
| 204 | |
| 205 | it('extracts module from a default import', () => { |
| 206 | expect(extractModules("import foo from 'lodash'")).toEqual(['lodash']) |