Skip to content

Commit ca96d8d

Browse files
committed
remove ghostStories global
1 parent a3e829f commit ca96d8d

File tree

3 files changed

+8
-1029
lines changed

3 files changed

+8
-1029
lines changed

code/addons/a11y/src/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export const afterEach: AfterEach<any> = async ({
2020
}) => {
2121
const a11yParameter: A11yParameters | undefined = parameters.a11y;
2222
const a11yGlobals = globals.a11y;
23-
const isGhostStories = !!globals.ghostStories;
23+
const isInternalRenderAnalysis = !!globals.renderAnalysis;
2424

2525
const shouldRunEnvironmentIndependent =
26-
!isGhostStories &&
26+
!isInternalRenderAnalysis &&
2727
a11yParameter?.disable !== true &&
2828
a11yParameter?.test !== 'off' &&
2929
a11yGlobals?.manual !== true;

code/addons/vitest/src/vitest-plugin/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ export const storybookTest = async (options?: UserOptions): Promise<Plugin[]> =>
244244
plugins.push(mdxStubPlugin);
245245
}
246246

247+
let withinAgenticSetupSession = false;
248+
247249
const storybookTestPlugin: Plugin = {
248250
name: 'vite-plugin-storybook-test',
249251
async transformIndexHtml(html) {
@@ -384,16 +386,7 @@ export const storybookTest = async (options?: UserOptions): Promise<Plugin[]> =>
384386
manual: !shouldRunA11yTests,
385387
};
386388

387-
if (process.env.STORYBOOK_COMPONENT_PATHS) {
388-
globals.ghostStories = {
389-
enabled: true,
390-
};
391-
globals.renderAnalysis = {
392-
enabled: true,
393-
};
394-
}
395-
396-
if (detectAgent()) {
389+
if (process.env.STORYBOOK_COMPONENT_PATHS || withinAgenticSetupSession) {
397390
globals.renderAnalysis = {
398391
enabled: true,
399392
};
@@ -475,7 +468,9 @@ export const storybookTest = async (options?: UserOptions): Promise<Plugin[]> =>
475468
// When an agent is running vitest via CLI, inject a reporter that sends
476469
// detailed test result telemetry (pass/fail, error analysis, empty renders)
477470
const agent = detectAgent();
478-
if (agent && (await isWithinInitialSession(['init', 'ai-prepare']))) {
471+
withinAgenticSetupSession =
472+
!!agent && (await isWithinInitialSession(['init', 'ai-prepare']));
473+
if (agent && withinAgenticSetupSession) {
479474
context.vitest.config.reporters.push(
480475
new AgentTelemetryReporter({
481476
configDir: finalOptions.configDir,

0 commit comments

Comments
 (0)