Skip to content
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

Release: Prerelease 8.5.0-alpha.11 #29700

Merged
merged 66 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
4ae12fe
feat: update component meta on file change
Nov 3, 2024
b9ac9dd
feat: invalidate modules and trigger full reload on file change
Nov 3, 2024
8f0ad55
Refactor "run all tests" behavior to reuse the RUN_REQUEST event and …
ghengeveld Nov 18, 2024
51a4c48
Drop unused event
ghengeveld Nov 19, 2024
50b6b22
Add type
ghengeveld Nov 19, 2024
d849ed7
allow passing generic up
ndelangen Nov 19, 2024
917bb30
add useful generic types
ndelangen Nov 19, 2024
e47e23a
do not wrap custom render
ndelangen Nov 19, 2024
4e01e33
refactor ui of test addon
ndelangen Nov 19, 2024
3196ee6
add editing
ndelangen Nov 19, 2024
9c473ef
Extend tests
ghengeveld Nov 19, 2024
a6d1c15
Extract fetch request and add timeout + error handling
ghengeveld Nov 19, 2024
d15b6a3
Don't count skipped tests, nor docs
ghengeveld Nov 19, 2024
2f6e0ea
Respect story tags and Vitest config when filtering stories for testing
ghengeveld Nov 20, 2024
53c8fcb
Merge branch 'next' into determine-total-test-count
ghengeveld Nov 20, 2024
ac091c1
cleanup
ndelangen Nov 20, 2024
e9aa7fb
Merge branch 'next' into norbert/testmodule-options
ndelangen Nov 20, 2024
c889cfb
move editing to local state and move custom state to config and make …
ndelangen Nov 20, 2024
fa74d64
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 21, 2024
d645bb5
Merge branch 'next' into determine-total-test-count
ndelangen Nov 22, 2024
7a53842
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 22, 2024
fa73dd0
Only filter out skipped stories in the progress report, not when load…
ghengeveld Nov 22, 2024
b66b5fe
emit config change event when it's set & emit config along with switc…
ndelangen Nov 22, 2024
34b2a53
Merge branch 'norbert/testmodule-options' of https://github.com/story…
ndelangen Nov 22, 2024
b8e0e2e
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 22, 2024
a27d8fd
Add missing tags to mock data
ghengeveld Nov 22, 2024
6938f52
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 22, 2024
f62c975
add to list of exports
ndelangen Nov 22, 2024
29f1b77
Merge branch 'norbert/testmodule-options' of https://github.com/story…
ndelangen Nov 22, 2024
28e06fe
delete dependency injected components feature
ndelangen Nov 22, 2024
732d277
Merge branch 'determine-total-test-count' of https://github.com/story…
ndelangen Nov 22, 2024
f603ffb
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 22, 2024
9a2767f
remove from type
ndelangen Nov 22, 2024
4956363
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 22, 2024
5419509
Revert "Build: Add workaround resolution for Angular sandboxes"
yannbf Nov 23, 2024
b95adad
Apply suggestions from code review
yannbf Nov 23, 2024
933f19f
Merge pull request #29695 from storybookjs/revert-29690-yann/fix-angu…
yannbf Nov 23, 2024
a63b410
Merge branch 'next' into determine-total-test-count
ndelangen Nov 25, 2024
255e11f
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 25, 2024
96bbf98
make the check on CI reliable, and run earlier
ndelangen Nov 25, 2024
23aa9b8
remove test for disabled button
ndelangen Nov 25, 2024
942e321
Merge branch 'determine-total-test-count' into norbert/testmodule-opt…
ndelangen Nov 25, 2024
2e4075f
fixes
ndelangen Nov 25, 2024
9c2e624
Merge pull request #29656 from storybookjs/determine-total-test-count
JReinhold Nov 25, 2024
27279ec
refactor the sidebarbottom to support dynamic height content
ndelangen Nov 26, 2024
adb4e15
add more stories & cleanup
ndelangen Nov 26, 2024
8ebbba4
Merge branch 'next' into norbert/testmodule-options
ndelangen Nov 26, 2024
fc102a9
Frameworks: Add Vite 6 support
yannbf Nov 26, 2024
bf59285
add new resolved configs
yannbf Nov 26, 2024
f0ebdc1
Also emit deprecated TESTING_MODULE_RUN_ALL_REQUEST event for backwar…
ghengeveld Nov 26, 2024
e03be02
fix tests
ndelangen Nov 26, 2024
2161c5a
Add missing exports
ghengeveld Nov 26, 2024
3f34f9d
rename slow to indicate it's about the CSS transition being toggled o…
ndelangen Nov 26, 2024
27a47e8
add client conditions from Vite 6
yannbf Nov 26, 2024
995f9f3
Merge pull request #29662 from storybookjs/norbert/testmodule-options
ndelangen Nov 26, 2024
8e5be14
Merge pull request #29710 from storybookjs/yann/support-vite-6
yannbf Nov 26, 2024
ac03998
Merge pull request #29711 from storybookjs/backwards-compat-run-all
ghengeveld Nov 26, 2024
d4fa610
Fix esm only import from vitest
valentinpalkovic Nov 26, 2024
91c76ac
Revert "Fix esm only import from vitest"
valentinpalkovic Nov 26, 2024
965b4c1
Merge pull request #29518 from IonianPlayboy/fix-vue3-vite-hmr-docgen
kasperpeulen Nov 26, 2024
bb0fd7e
temporarily remove react native sandbox
yannbf Nov 27, 2024
eb8007f
Merge pull request #29722 from storybookjs/yann/temp-remove-rn-sandbox
yannbf Nov 27, 2024
d4ecd0d
Revert "temporarily remove react native sandbox"
yannbf Nov 27, 2024
182c509
Build: Temporarily downgrade Vite
yannbf Nov 27, 2024
5a27290
Merge pull request #29723 from storybookjs/yann/downgrade-to-vite-5
yannbf Nov 27, 2024
3f34b80
Write changelog for 8.5.0-alpha.11 [skip ci]
storybook-bot Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,15 @@ jobs:
root: .
paths:
- code/node_modules
- code/addons
- scripts/node_modules
- code/bench
- code/examples
- code/node_modules
- code/addons
- code/frameworks
- code/deprecated
- code/lib
- code/core
- code/builders
- code/ui
- code/renderers
- code/presets
- .verdaccio-cache
Expand Down Expand Up @@ -269,16 +267,30 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- nx/set-shas:
main-branch-name: "next"
workflow-name: << pipeline.parameters.workflow >>
- run:
name: install in scripts
command: |
cd scripts
yarn install
- run:
name: install in code
command: |
cd code
yarn install
- run:
name: Compile
command: |
yarn task --task compile --start-from=compile --no-link --debug
- run:
name: Check
command: |
yarn task --task compile --start-from=auto --no-link --debug
yarn task --task check --start-from=auto --no-link --debug
yarn task --task check --start-from=check --no-link --debug
- run:
name: Ensure no changes pending
command: |
git diff --exit-code
- report-workflow-on-failure
- cancel-workflow-on-failure
Expand Down Expand Up @@ -807,9 +819,7 @@ workflows:
- bench-packages:
requires:
- build
- check:
requires:
- build
- check
- unit-tests:
requires:
- build
Expand Down Expand Up @@ -885,9 +895,7 @@ workflows:
- bench-packages:
requires:
- build
- check:
requires:
- build
- check
- unit-tests:
requires:
- build
Expand Down Expand Up @@ -964,9 +972,7 @@ workflows:
- bench-packages:
requires:
- build
- check:
requires:
- build
- check
- unit-tests:
requires:
- build
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 8.5.0-alpha.11

- Core + Addon Test: Refactor test API and fix total test count - [#29656](https://github.com/storybookjs/storybook/pull/29656), thanks @ghengeveld!
- Core: Emit deprecated `TESTING_MODULE_RUN_ALL_REQUEST` for backward compatibility - [#29711](https://github.com/storybookjs/storybook/pull/29711), thanks @ghengeveld!
- Frameworks: Add Vite 6 support - [#29710](https://github.com/storybookjs/storybook/pull/29710), thanks @yannbf!
- TestAddon: Refactor UI & add config options - [#29662](https://github.com/storybookjs/storybook/pull/29662), thanks @ndelangen!
- Vue: Fix `vue-component-meta` docgen HMR not working - [#29518](https://github.com/storybookjs/storybook/pull/29518), thanks @IonianPlayboy!

## 8.5.0-alpha.10

- Addon Test: Use pathe for better windows support - [#29676](https://github.com/storybookjs/storybook/pull/29676), thanks @yannbf!
Expand Down
5 changes: 2 additions & 3 deletions code/addons/test/src/components/ContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useState,
} from 'react';

import { Button, type ListItem } from 'storybook/internal/components';
import { Button, ListItem } from 'storybook/internal/components';
import { useStorybookApi } from 'storybook/internal/manager-api';
import { useTheme } from 'storybook/internal/theming';
import { type API_HashEntry, type Addon_TestProviderState } from 'storybook/internal/types';
Expand All @@ -23,8 +23,7 @@ export const ContextMenuItem: FC<{
state: Addon_TestProviderState<{
testResults: TestResult[];
}>;
ListItem: typeof ListItem;
}> = ({ context, state, ListItem }) => {
}> = ({ context, state }) => {
const api = useStorybookApi();
const [isDisabled, setDisabled] = useState(false);

Expand Down
55 changes: 55 additions & 0 deletions code/addons/test/src/components/Description.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';

import { Link as LinkComponent } from 'storybook/internal/components';
import { type TestProviderConfig, type TestProviderState } from 'storybook/internal/core-events';
import { styled } from 'storybook/internal/theming';

import { RelativeTime } from './RelativeTime';

export const DescriptionStyle = styled.div(({ theme }) => ({
fontSize: theme.typography.size.s1,
color: theme.barTextColor,
}));

export function Description({
errorMessage,
setIsModalOpen,
state,
}: {
state: TestProviderConfig & TestProviderState;
errorMessage: string;
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
}) {
let description: string | React.ReactNode = 'Not run';

if (state.running) {
description = state.progress
? `Testing... ${state.progress.numPassedTests}/${state.progress.numTotalTests}`
: 'Starting...';
} else if (state.failed && !errorMessage) {
description = '';
} else if (state.crashed || (state.failed && errorMessage)) {
description = (
<>
<LinkComponent
isButton
onClick={() => {
setIsModalOpen(true);
}}
>
{state.error?.name || 'View full error'}
</LinkComponent>
</>
);
} else if (state.progress?.finishedAt) {
description = (
<RelativeTime
timestamp={new Date(state.progress.finishedAt)}
testCount={state.progress.numTotalTests}
/>
);
} else if (state.watching) {
description = 'Watching for file changes';
}
return <DescriptionStyle id="testing-module-description">{description}</DescriptionStyle>;
}
19 changes: 18 additions & 1 deletion code/addons/test/src/components/RelativeTime.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import { useEffect, useState } from 'react';

import { getRelativeTimeString } from '../manager';
export function getRelativeTimeString(date: Date): string {
const delta = Math.round((date.getTime() - Date.now()) / 1000);
const cutoffs = [60, 3600, 86400, 86400 * 7, 86400 * 30, 86400 * 365, Infinity];
const units: Intl.RelativeTimeFormatUnit[] = [
'second',
'minute',
'hour',
'day',
'week',
'month',
'year',
];

const unitIndex = cutoffs.findIndex((cutoff) => cutoff > Math.abs(delta));
const divisor = unitIndex ? cutoffs[unitIndex - 1] : 1;
const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
return rtf.format(Math.floor(delta / divisor), units[unitIndex]);
}

export const RelativeTime = ({ timestamp, testCount }: { timestamp: Date; testCount: number }) => {
const [relativeTimeString, setRelativeTimeString] = useState(null);
Expand Down
4 changes: 2 additions & 2 deletions code/addons/test/src/components/Subnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const StyledSubnav = styled.nav(({ theme }) => ({
paddingLeft: 15,
}));

export interface SubnavProps {
interface SubnavProps {
controls: Controls;
controlStates: ControlStates;
status: Call['status'];
Expand All @@ -64,7 +64,7 @@ const Note = styled(TooltipNote)(({ theme }) => ({
fontFamily: theme.typography.fonts.base,
}));

export const StyledIconButton = styled(IconButton as any)(({ theme }) => ({
const StyledIconButton = styled(IconButton)(({ theme }) => ({
color: theme.textMutedColor,
margin: '0 3px',
}));
Expand Down
158 changes: 158 additions & 0 deletions code/addons/test/src/components/TestProviderRender.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import React from 'react';

import type { TestProviderConfig, TestProviderState } from 'storybook/internal/core-events';
import { ManagerContext } from 'storybook/internal/manager-api';
import { styled } from 'storybook/internal/theming';
import { Addon_TypesEnum } from 'storybook/internal/types';

import type { Meta, StoryObj } from '@storybook/react';
import { fn, within } from '@storybook/test';

import type { Config, Details } from '../constants';
import { TestProviderRender } from './TestProviderRender';

type Story = StoryObj<typeof TestProviderRender>;
const managerContext: any = {
state: {
testProviders: {
'test-provider-id': {
id: 'test-provider-id',
name: 'Test Provider',
type: Addon_TypesEnum.experimental_TEST_PROVIDER,
},
},
},
api: {
getDocsUrl: fn().mockName('api::getDocsUrl'),
emit: fn().mockName('api::emit'),
updateTestProviderState: fn().mockName('api::updateTestProviderState'),
},
};

const config: TestProviderConfig = {
id: 'test-provider-id',
name: 'Test Provider',
type: Addon_TypesEnum.experimental_TEST_PROVIDER,
runnable: true,
watchable: true,
};

const baseState: TestProviderState<Details, Config> = {
cancellable: true,
cancelling: false,
crashed: false,
error: null,
failed: false,
running: false,
watching: false,
config: {
a11y: false,
coverage: false,
},
details: {
testResults: [
{
endTime: 0,
startTime: 0,
status: 'passed',
message: 'All tests passed',
results: [
{
storyId: 'story-id',
status: 'success',
duration: 100,
testRunId: 'test-run-id',
},
],
},
],
},
};

const Content = styled.div({
padding: '12px 6px',
display: 'flex',
flexDirection: 'column',
gap: '12px',
});

export default {
title: 'TestProviderRender',
component: TestProviderRender,
args: {
state: {
...config,
...baseState,
},
api: managerContext.api,
},
decorators: [
(StoryFn) => (
<Content>
<StoryFn />
</Content>
),
(StoryFn) => (
<ManagerContext.Provider value={managerContext}>
<StoryFn />
</ManagerContext.Provider>
),
],
} as Meta<typeof TestProviderRender>;

export const Default: Story = {
args: {
state: {
...config,
...baseState,
},
},
};

export const Running: Story = {
args: {
state: {
...config,
...baseState,
running: true,
},
},
};

export const EnableA11y: Story = {
args: {
state: {
...config,
...baseState,
details: {
testResults: [],
},
config: {
a11y: true,
coverage: false,
},
},
},
};

export const EnableEditing: Story = {
args: {
state: {
...config,
...baseState,
config: {
a11y: true,
coverage: false,
},
details: {
testResults: [],
},
},
},

play: async ({ canvasElement }) => {
const screen = within(canvasElement);

screen.getByLabelText('Edit').click();
},
};
Loading