kibana/packages/shared-ux/page
Maja Grubic dd03796cdf
[SharedUX] Fix Storybook (#144677)
## Summary

When working on changing one of our components, I noticed that the our
storybook is missing a lot of components. You can see that there are no
components under `No Data` besides `Prompt`:
<img width="224" alt="Screenshot 2022-11-04 at 18 14 22"
src="https://user-images.githubusercontent.com/1937956/200268753-f2708d0b-f467-46d2-b04f-5426df1ae141.png">

Troubleshooting was challenging because the console was full of
misleading errors, but also - because storybook does not load source
maps - another issue we should look into.

After some digging, the root cause was coming from using `jest.fn` in
`redirect_app_links` component:

https://github.com/elastic/kibana/blob/main/packages/shared-ux/link/redirect_app/mocks/src/jest.ts#L19
Since we have a nice component tree here, the other components' stories
directly or indirectly depend on this module, so they failed to load.

I believe something in the jest configuration was not properly
configured, so it prevented `jest.fn()` to resolve. But given this is
the only place where we use `jest.fn` in that module, I replaced it with
a stub and got rid of jest entirely. And voila - stories are back:
<img width="642" alt="Screenshot 2022-11-07 at 09 54 27"
src="https://user-images.githubusercontent.com/1937956/200269730-549d3fca-392f-42e9-a941-6ef37000242e.png">

I also added `npm_module_types` to a few places where I thought they
were missing.


### Checklist

Delete any items that are not applicable to this PR.



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-11-08 18:29:59 +01:00
..
analytics_no_data rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00
kibana_no_data rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00
kibana_template rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00
no_data [SharedUX] Fix Storybook (#144677) 2022-11-08 18:29:59 +01:00
no_data_config rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00
solution_nav rename codeowners from shared-ux to global-experience (#144746) 2022-11-08 09:13:16 -07:00