TASK-BUGFIX-20250419-234000.md•1.93 kB
# Task: Fix Jest Module Resolution Error in createPayment.ts
**Status:** Pending
**Coordinator:** TASK-CMD-20250419-190107
**Assigned To:** bug-fixer
**Acceptance Criteria:**
- The import statement for `config` in `src/tools/createPayment.ts` is changed from `../config.js` to `../config`.
- The command `npx jest tests/integration.test.ts` no longer throws the "Cannot find module '../config.js'" error related to `createPayment.ts`. (Note: Other errors like missing certificate might still occur).
**Context Files:**
- `src/tools/createPayment.ts` (Specifically line 1)
- `tests/integration.test.ts`
- `tsconfig.json`
- `jest.config.js`
**Error Details:**
The file `src/tools/createPayment.ts` still incorrectly uses `../config.js` in its import statement, causing Jest tests to fail.
```
Cannot find module '../config.js' from 'src/tools/createPayment.ts'
> 1 | import { config as appConfig } from '../config.js'; // 导入配置模块并重命名 (Removed .js extension)
| ^
```
**Checklist:**
- [⏳] Modify line 1 of `src/tools/createPayment.ts` to `import { config as appConfig } from '../config';`.
- [⏳] Run `npx jest tests/integration.test.ts` to verify the specific import error is resolved.
- [📣] Report completion or issues.
---
**Status:** ✅ Complete
**Outcome:** Success
**Summary:** Fixed incorrect import statement in `src/tools/createPayment.ts` (line 1) by removing the `.js` extension.
**Root Cause:** The import statement incorrectly included the `.js` extension (`../config.js`), which is not standard for TypeScript/Jest module resolution in this project setup.
**References:** [`src/tools/createPayment.ts` (modified)]
**Verification:** Ran `npx jest tests/integration.test.ts`. The original "Cannot find module '../config.js'" error is resolved. Test suite still fails due to a separate issue (missing certificate file `yop_platform_rsa_cert_rsa.cer`), which is outside the scope of this task.