dosubot[bot] commented on issue #33788:
URL: https://github.com/apache/superset/issues/33788#issuecomment-2980030129

   <!-- Greeting -->
   Hi @pksilen! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.
   
   <!-- Answer -->
   Here’s what’s going on and how you can address each issue:
   
   1. The unused `sections` import in `controlPanel.ts` is a known issue with 
the plugin generator template. It’s safe to remove or comment out this import 
if you’re not using it—this won’t affect functionality and will resolve the 
build error. This is due to stricter TypeScript/lint settings in your 
environment and isn’t required for most plugins.
   
   2. The test failures are because the generated plugin’s Jest config 
sometimes doesn’t specify the test environment. You need to install 
`jest-environment-jsdom` and add `testEnvironment: "jsdom"` to your 
`jest.config.js`. This simulates a browser environment, which is required for 
visualization/plugin tests. The official templates and docs expect this, but 
it’s easy to miss if you’re setting up manually or if the generator template is 
out of sync with your environment. See the [Superset Jest config 
example](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset-frontend/jest.config.js).
   
   3. The slow test execution is mostly due to the heavy dependencies 
(`@superset-ui/core`, `@superset-ui/chart-controls`) being loaded cold for each 
test run, and possibly because tests are running serially. There’s not much you 
can do unless you optimize your test setup or reduce dependency size, but you 
can experiment with Jest’s parallelization settings or cache to speed things up.
   
   4. The warnings about `You should call configure(...) before calling other 
methods` come from the Superset translation system. The translation singleton 
expects to be initialized with `configure()` before any translation calls (like 
`t` or `tn`). To fix this, create a Jest setup file (e.g., `jest.setup.js`) 
with:
      ```js
      import { configure } from '@superset-ui/core';
      configure({ languagePack: {} });
      ```
      Then add this file to your `jest.config.js` under `setupFilesAfterEnv`. 
This will suppress the warnings and properly initialize translations for all 
tests. See the [translation system 
implementation](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset-frontend/packages/superset-ui-core/src/translation/TranslatorSingleton.ts).
   
   There are some related issues and discussions in the Superset repo about 
plugin build/test friction and the plugin system being in flux, but nothing 
that directly addresses all these points. The plugin generator and docs may lag 
behind the latest best practices, so manual tweaks like these are sometimes 
necessary.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33788)


-- 
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]

Reply via email to