codeflash-internal/django
Codeflash Bot 9ec5eb7c5a Fix JS/TS import resolution to detect export style from source code
When generating tests for class methods (e.g., ModulesContainer.getById),
the test generator was incorrectly assuming default import style, generating:
  import ModulesContainer from '...'

This caused "Cannot find module" errors when:
1. The class was not exported at all
2. The class used named export (export class X) instead of default export

This fix:
- Adds _detect_export_style() to parse source code and detect actual export style
- Modifies _resolve_import() to use detected export style:
  - 'export default class X' → default import
  - 'export class X' → named import
  - No export → named import (test will fail, surfacing the issue)
- Adds comprehensive unit tests for all scenarios

Affected traces: 12332328-80e8-4bde-bdd6-c76ac373675a, 73ccd4c6-a4f7-467a-8356-5199e9d9b877, 989dcbda-bc27-40b7-aed0-0ab51fd00e6d, and others with ERR_MODULE_NOT_FOUND

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-01 16:23:17 +00:00
..
aiservice Fix JS/TS import resolution to detect export style from source code 2026-04-01 16:23:17 +00:00
.dockerignore local setup (#1898) 2025-11-17 12:35:09 -08:00