sam-hieken opened a new issue, #30297:
URL: https://github.com/apache/superset/issues/30297

   ### Bug description
   
   Hi,
   
   I get the following error after generating and trying to build a custom 
visualization plugin (without making any code changes). I'm following [the 
official tutorial from Preset](https://www.youtube.com/watch?v=LDHFY9xTzls). 
   
   ```
    FAIL  test/plugin/transformProps.test.ts
     ● Test suite failed to run
   
       The error below may be caused by using the wrong test environment, see 
https://jestjs.io/docs/configuration#testenvironment-string.
       Consider using the "jsdom" test environment.
       
       ReferenceError: window is not defined
   
         17 |  * under the License.
         18 |  */
       > 19 | import { ChartProps, supersetTheme } from '@superset-ui/core';
            | ^
         20 | import transformProps from '../../src/plugin/transformProps';
         21 |
         22 | describe('SupersetPluginBetterTable transformProps', () => {
   
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/utils/logging.js:24:17)
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/utils/index.js:45:39)
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/index.js:13:14)
         at Object.require (test/plugin/transformProps.test.ts:19:1)
   ```
   
   
   
   ### How to reproduce the bug
   
   Follow the exact steps taken in [Building Custom Viz Plugins in 
Superset](https://www.youtube.com/watch?v=LDHFY9xTzls) with the latest 
repository:
   
   ```
   # Install yo
   npm i -g yo
   cd superset-frontend/packages/generator-superset
   npm i
   npm link
   
   cd /tmp
   mkdir my-plugin
   cd my-plugin/
   yo @superset-ui/superset
   ```
   
   At this point, when running `npm ci && npm run build`,
   you'll receive the error:
   
   ```
   src/plugin/controlPanel.ts:22:3 - error TS6133: 'sections' is declared but 
its value is never read.
   
   22   sections,
        ~~~~~~~~
   ```
   
   This is where the expected output diverges from the tutorial...
   
   OK, so obviously for testing purposes I don't care if `sections` isn't used; 
so I set `"noUnusedLocals": false` in `tsconfig.json`. 
   
   Now when I rerun `npm ci && npm run build`:
   
   ```
    FAIL  test/plugin/buildQuery.test.ts
     ● Test suite failed to run
   
       The error below may be caused by using the wrong test environment, see 
https://jestjs.io/docs/configuration#testenvironment-string.
       Consider using the "jsdom" test environment.
       
       ReferenceError: window is not defined
   
         17 |  * under the License.
         18 |  */
       > 19 | import { buildQueryContext, QueryFormData } from 
'@superset-ui/core';
            | ^
         20 |
         21 | /**
         22 |  * The buildQuery function is used to create an instance of 
QueryContext that's
   
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/utils/logging.js:24:17)
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/utils/index.js:45:39)
         at Object.<anonymous> 
(node_modules/@superset-ui/core/lib/index.js:13:14)
         at Object.require (src/plugin/buildQuery.ts:19:1)
         at Object.require (test/plugin/buildQuery.test.ts:19:1)
   ```
   
   ### Screenshots/recordings
   
   N/A
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.10
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   My OS is Ubuntu 22.04, and Node version is 20.13.1. Again, I followed the 
exact steps specified in Preset's official tutorial, which involved no code 
changes; this issue shouldn't occur under any circumstances. If the tutorial is 
outdated, I'd appreciate if you guys could outline some steps for plugin 
development as it's quite poorly documented.
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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