@@ -8,7 +8,10 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
88
99// Stub out heavy dependencies so the module can be imported
1010vi . mock ( '@storybook/angular/preset' , ( ) => ( {
11- core : ( ) => ( { options : { } } ) ,
11+ core : async ( ) => ( {
12+ options : { } ,
13+ channelOptions : { wsToken : 'mock-token' } ,
14+ } ) ,
1215 addons : [ ] ,
1316} ) ) ;
1417
@@ -29,11 +32,14 @@ vi.mock('@analogjs/vite-plugin-angular', () => ({
2932
3033// eslint-disable-next-line @typescript-eslint/no-explicit-any
3134let viteFinal : any ;
35+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36+ let core : any ;
3237
3338beforeEach ( async ( ) => {
3439 vi . resetModules ( ) ;
3540 const mod = await import ( './preset' ) ;
3641 viteFinal = mod . viteFinal ;
42+ core = mod . core ;
3743} ) ;
3844
3945/**
@@ -43,7 +49,10 @@ beforeEach(async () => {
4349 */
4450const registerDependencyMocks = ( ) => {
4551 vi . doMock ( '@storybook/angular/preset' , ( ) => ( {
46- core : ( ) => ( { options : { } } ) ,
52+ core : async ( ) => ( {
53+ options : { } ,
54+ channelOptions : { wsToken : 'mock-token' } ,
55+ } ) ,
4756 addons : [ ] ,
4857 } ) ) ;
4958 vi . doMock ( 'storybook/internal/types' , ( ) => ( { } ) ) ;
@@ -72,6 +81,21 @@ const importWithAngularVersion = async (major: string) => {
7281 return mod . viteFinal ;
7382} ;
7483
84+ describe ( 'core' , ( ) => {
85+ it ( 'should await PresetCore and include channelOptions from resolved config' , async ( ) => {
86+ const result = await core ( { } , { } ) ;
87+
88+ expect ( result . channelOptions ?. wsToken ) . toBe ( 'mock-token' ) ;
89+ } ) ;
90+
91+ it ( 'should override builder with @storybook/builder-vite' , async ( ) => {
92+ const result = await core ( { } , { } ) ;
93+
94+ expect ( result . builder ) . toBeDefined ( ) ;
95+ expect ( result . builder . name ) . toBeDefined ( ) ;
96+ } ) ;
97+ } ) ;
98+
7599describe ( 'viteFinal' , ( ) => {
76100 const createMockOptions = ( overrides = { } ) => ( {
77101 configDir : '.storybook' ,
0 commit comments