codeant-ai-for-open-source[bot] commented on code in PR #44042:
URL: https://github.com/apache/superset/pull/44042#discussion_r3964201796
##########
superset-frontend/plugins/plugin-chart-point-cluster-map/test/MapLibre.test.tsx:
##########
@@ -70,6 +70,23 @@ jest.mock('@apache-superset/core/theme', () => ({
jest.mock('maplibre-gl/dist/maplibre-gl.css', () => ({}));
jest.mock('../src/MapLibre.css', () => ({}));
+// maplibre-gl 6 is an ESM-only package with no "require"/"default" export
+// condition, so jest's (CJS-based) resolver can't locate the real module to
+// mock over it by name; { virtual: true } skips that resolution step.
+//
+// The mock jest.fn() is created inline (not hoisted out to a `const`)
+// because MapLibre.tsx calls maplibregl.setWorkerUrl() synchronously at
+// import time, and `import`/jest.mock() calls are themselves hoisted above
+// this file's plain `const` declarations — a `const` referenced here would
+// still be in its temporal dead zone when that import-time call fires.
+jest.mock(
+ 'maplibre-gl',
+ () => ({ __esModule: true, setWorkerUrl: jest.fn() }),
+ { virtual: true },
+);
Review Comment:
**Suggestion:** The virtual mock replaces MapLibre entirely, so this test
cannot detect missing copied worker files, bad MIME handling, or failures
resolving the worker’s relative shared-module import. [incomplete
implementation]
**Assessment:** 🟠 `Major` · 🔁 `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8b00e295e9374280a9d394a44e897193&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8b00e295e9374280a9d394a44e897193&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-point-cluster-map/test/MapLibre.test.tsx
**Line:** 82:86
**Comment:**
*Incomplete Implementation: The virtual mock replaces MapLibre
entirely, so this test cannot detect missing copied worker files, bad MIME
handling, or failures resolving the worker’s relative shared-module import.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44042&comment_hash=6b084d8817021356655b2b884f962147e0ad753724cc430ca854bf9515aeabfa&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44042&comment_hash=6b084d8817021356655b2b884f962147e0ad753724cc430ca854bf9515aeabfa&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]