diff --git a/CHANGELOG.prerelease.md b/CHANGELOG.prerelease.md
index 2a2eb7b7453d..2be90903a97a 100644
--- a/CHANGELOG.prerelease.md
+++ b/CHANGELOG.prerelease.md
@@ -1,3 +1,10 @@
+## 8.5.0-beta.6
+
+- Addon Test: Always use installed version of vitest - [#30134](https://github.com/storybookjs/storybook/pull/30134), thanks @kasperpeulen!
+- Addon Test: Fix documentation links - [#30128](https://github.com/storybookjs/storybook/pull/30128), thanks @yannbf!
+- Addon Test: Use correct vitest config file path - [#30135](https://github.com/storybookjs/storybook/pull/30135), thanks @kasperpeulen!
+- Automigration: Improve addon-a11y-addon-test - [#30127](https://github.com/storybookjs/storybook/pull/30127), thanks @valentinpalkovic!
+
## 8.5.0-beta.5
- Addon Test: Only reset story count on file change when watch mode is enabled - [#30121](https://github.com/storybookjs/storybook/pull/30121), thanks @ghengeveld!
diff --git a/code/.storybook/main.ts b/code/.storybook/main.ts
index 623d6f5c525e..9870741de29e 100644
--- a/code/.storybook/main.ts
+++ b/code/.storybook/main.ts
@@ -4,6 +4,7 @@ import type { StorybookConfig } from '../frameworks/react-vite';
const componentsPath = join(__dirname, '../core/src/components');
const managerApiPath = join(__dirname, '../core/src/manager-api');
+const imageContextPath = join(__dirname, '..//frameworks/nextjs/src/image-context.ts');
const config: StorybookConfig = {
stories: [
@@ -146,6 +147,7 @@ const config: StorybookConfig = {
'storybook/internal/components': componentsPath,
'@storybook/manager-api': managerApiPath,
'storybook/internal/manager-api': managerApiPath,
+ 'sb-original/image-context': imageContextPath,
}
: {}),
},
diff --git a/code/addons/test/src/components/Interaction.tsx b/code/addons/test/src/components/Interaction.tsx
index 4ceef384d02a..75797c65c5a3 100644
--- a/code/addons/test/src/components/Interaction.tsx
+++ b/code/addons/test/src/components/Interaction.tsx
@@ -23,7 +23,7 @@ const MethodCallWrapper = styled.div(() => ({
const RowContainer = styled('div', {
shouldForwardProp: (prop) => !['call', 'pausedAt'].includes(prop.toString()),
-})<{ call: Call; pausedAt: Call['id'] }>(
+})<{ call: Call; pausedAt: Call['id'] | undefined }>(
({ theme, call }) => ({
position: 'relative',
display: 'flex',
@@ -117,6 +117,9 @@ const RowMessage = styled('div')(({ theme }) => ({
export const Exception = ({ exception }: { exception: Call['exception'] }) => {
const filter = useAnsiToHtmlFilter();
+ if (!exception) {
+ return null;
+ }
if (isJestError(exception)) {
return ;
}
@@ -187,7 +190,7 @@ export const Interaction = ({
- {childCallIds?.length > 0 && (
+ {(childCallIds?.length ?? 0) > 0 && (
}
diff --git a/code/addons/test/src/components/MatcherResult.tsx b/code/addons/test/src/components/MatcherResult.tsx
index 46b5e540ad8d..fa01b73548ec 100644
--- a/code/addons/test/src/components/MatcherResult.tsx
+++ b/code/addons/test/src/components/MatcherResult.tsx
@@ -74,10 +74,10 @@ export const MatcherResult = ({
{lines.flatMap((line: string, index: number) => {
if (line.startsWith('expect(')) {
const received = getParams(line, 7);
- const remainderIndex = received && 7 + received.length;
+ const remainderIndex = received ? 7 + received.length : 0;
const matcher = received && line.slice(remainderIndex).match(/\.(to|last|nth)[A-Z]\w+\(/);
if (matcher) {
- const expectedIndex = remainderIndex + matcher.index + matcher[0].length;
+ const expectedIndex = remainderIndex + (matcher.index ?? 0) + matcher[0].length;
const expected = getParams(line, expectedIndex);
if (expected) {
return [
diff --git a/code/addons/test/src/components/MethodCall.tsx b/code/addons/test/src/components/MethodCall.tsx
index 59b907d13daa..34d1e6bb6f58 100644
--- a/code/addons/test/src/components/MethodCall.tsx
+++ b/code/addons/test/src/components/MethodCall.tsx
@@ -139,7 +139,7 @@ export const Node = ({
case Object.prototype.hasOwnProperty.call(value, '__class__'):
return ;
case Object.prototype.hasOwnProperty.call(value, '__callId__'):
- return ;
+ return ;
/* eslint-enable no-underscore-dangle */
case Object.prototype.toString.call(value) === '[object Object]':
@@ -418,7 +418,7 @@ export const MethodCall = ({
callsById,
}: {
call?: Call;
- callsById: Map;
+ callsById?: Map;
}) => {
// Call might be undefined during initial render, can be safely ignored.
if (!call) {
@@ -434,7 +434,7 @@ export const MethodCall = ({
const callId = (elem as CallRef).__callId__;
return [
callId ? (
-
+
) : (
{elem as any}
),
diff --git a/code/addons/test/src/components/Panel.tsx b/code/addons/test/src/components/Panel.tsx
index cc2eaf233356..d6ea74843151 100644
--- a/code/addons/test/src/components/Panel.tsx
+++ b/code/addons/test/src/components/Panel.tsx
@@ -22,14 +22,6 @@ import type { API_StatusValue } from '@storybook/types';
import { ADDON_ID, STORYBOOK_ADDON_TEST_CHANNEL, TEST_PROVIDER_ID } from '../constants';
import { InteractionsPanel } from './InteractionsPanel';
-interface Interaction extends Call {
- status: Call['status'];
- childCallIds: Call['id'][];
- isHidden: boolean;
- isCollapsed: boolean;
- toggleCollapsed: () => void;
-}
-
const INITIAL_CONTROL_STATES = {
start: false,
back: false,
@@ -60,7 +52,7 @@ export const getInteractions = ({
const childCallMap = new Map();
return log
- .map(({ callId, ancestors, status }) => {
+ .map(({ callId, ancestors, status }) => {
let isHidden = false;
ancestors.forEach((ancestor) => {
if (collapsed.has(ancestor)) {
@@ -68,11 +60,12 @@ export const getInteractions = ({
}
childCallMap.set(ancestor, (childCallMap.get(ancestor) || []).concat(callId));
});
- return { ...calls.get(callId), status, isHidden };
+ return { ...calls.get(callId)!, status, isHidden };
})
- .map((call) => {
+ .map((call) => {
const status =
call.status === CallStates.ERROR &&
+ call.ancestors &&
callsById.get(call.ancestors.slice(-1)[0])?.status === CallStates.ACTIVE
? CallStates.ACTIVE
: call.status;
@@ -131,7 +124,7 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
const calls = useRef