-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tech/api package #5402
Tech/api package #5402
Conversation
Codecov Report
@@ Coverage Diff @@
## next #5402 +/- ##
==========================================
- Coverage 38.04% 37.93% -0.11%
==========================================
Files 643 645 +2
Lines 9420 9626 +206
Branches 1344 352 -992
==========================================
+ Hits 3584 3652 +68
- Misses 5268 5927 +659
+ Partials 568 47 -521
Continue to review full report at Codecov.
|
This will hopefully help restore/simplify some of the ondevice addons. ondevice-backgrounds is mostly broken at the moment because it's still expecting data coming through the websocket when some of the values are in state. |
# Conflicts: # addons/a11y/package.json # addons/actions/package.json # addons/backgrounds/package.json # addons/cssresources/package.json # addons/cssresources/src/css-resource-panel.tsx # addons/notes/package.json # app/react-native-server/package.json # app/react-native-server/src/client/manager/provider.js # examples-native/crna-kitchen-sink/package.json # lib/addons/package.json # lib/ui/package.json # yarn.lock
# Conflicts: # addons/a11y/package.json # addons/actions/package.json # addons/backgrounds/package.json # addons/cssresources/package.json # addons/notes/package.json # app/react-native-server/package.json # lib/addons/package.json # lib/api/src/modules/versions.ts # lib/ui/package.json # lib/ui/src/core/context.js
Seems these tests may be leaking memory:
|
…bug && CLEANUP tests log
Would like to investigate why some tests take so long
|
fee3a5e
to
62299a6
Compare
# Conflicts: # yarn.lock
@@ -264,7 +264,7 @@ jobs: | |||
at: . | |||
- run: | |||
name: Test | |||
command: yarn test --coverage --runInBand --core | |||
command: yarn test --coverage --w2 --core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This speeds up the processing of coverage a lot. It's limited to 2 CPUs since that seems to work on CIs best.
@@ -1,7 +1,7 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
|
|||
exports[`addon Info should render <Info /> and external markdown 1`] = ` | |||
<deprecated> | |||
<Component> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side-effect of muting the deprecation messages when running tests
componentWillUnmount() { | ||
const { api } = this.props; | ||
api.off(STORY_RENDERED, this.onStoryChange); | ||
const NotesPanel = ({ active }: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addon became state-less 🎉
], | ||
snapshotSerializers: ['jest-emotion', 'enzyme-to-json/serializer'], | ||
coverageDirectory: 'coverage', | ||
testEnvironment: 'jsdom', | ||
coverageReporters: ['lcov'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to improve the coverage report massively as well
warning, | ||
}); | ||
return deprecatedFn; | ||
jest.mock('util-deprecate', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecate
is already mocked, but this changes the implementation
@@ -1,7 +1,7 @@ | |||
import { navigator } from 'global'; | |||
|
|||
// The shortcut is our JSON-ifiable representation of a shortcut combination | |||
type Shortcut = string[]; | |||
import { KeyCollection, Event } from '../modules/shortcuts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jessica-Koch I'm hoping I did the merges correctly, It seems to all work. I hope this is in line with how you want it.
It's all in typescript now 🎉
Omg
Awesome!!!!
…Sent from my iPhone
On Mar 18, 2019, at 5:03 PM, Norbert de Langen ***@***.***> wrote:
@ndelangen commented on this pull request.
In lib/api/src/lib/shortcut.ts:
> @@ -1,7 +1,7 @@
import { navigator } from 'global';
// The shortcut is our JSON-ifiable representation of a shortcut combination
-type Shortcut = string[];
+import { KeyCollection, Event } from '../modules/shortcuts';
@Jessica-Koch I'm hoping I did the merges correctly, It seems to all work. I hope this is in line with how you want it.
It's all in typescript now 🎉
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Following up discussions in #5402, this a proposal for what a typed channel api could look like. Communication via channel is core to the storybook architecture. Adding type safety should help prevent bug and help improve code discovery for new contributors.
const checkDeprecatedThemeOptions = options => { | ||
if (Object.keys(deprecatedThemeOptions).find(key => !!options[key])) { | ||
const checkDeprecatedThemeOptions = (options: Options) => { | ||
if (Object.values(deprecatedThemeOptions).find(v => !!v)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this check intended to do? Looks like it just checks whether deprecatedThemeOptions
has some values, which is always true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should map deprecated options to themeVars
name: "brandTitle";
url: "brandUrl";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that
if (Object.values({name: 'brandTitle', url: 'brandUrl'}).find(v => !!v))
evaluates to
if (['brandTitle', 'brandUrl'].find(v => !!v))
// same as
if ('brandTitle')
// same as
if (true)
Issue: Accessing state and API's is kinda bothersome right now.
This extracts the ManagerProvider & ManagerConsumer into a package called
@storybook/api
.The consumer can now be used in other places.
Also I migrated most of it to TypeScript