@@ -130,7 +130,8 @@ describe('EVAL_EDITOR', () => {
130130 name : ExternalLibraryName . NONE ,
131131 symbols : context . externalSymbols
132132 } ,
133- globals
133+ globals,
134+ languageOptions : context . languageOptions
134135 } ;
135136
136137 const newDefaultState = generateDefaultState ( workspaceLocation , {
@@ -397,7 +398,8 @@ describe('EVAL_TESTCASE', () => {
397398 name : ExternalLibraryName . NONE ,
398399 symbols : context . externalSymbols
399400 } ,
400- globals
401+ globals,
402+ languageOptions : context . languageOptions
401403 } ;
402404
403405 const newDefaultState = generateDefaultState ( workspaceLocation , {
@@ -689,23 +691,34 @@ describe('PLAYGROUND_EXTERNAL_SELECT', () => {
689691 name : newExternalLibraryName ,
690692 symbols
691693 } ,
692- globals
694+ globals,
695+ languageOptions : context . languageOptions
693696 } ;
694697
695- return expectSaga ( workspaceSaga )
696- . withState ( newDefaultState )
697- . put ( WorkspaceActions . changeExternalLibrary ( newExternalLibraryName , workspaceLocation ) )
698- . put ( WorkspaceActions . beginClearContext ( workspaceLocation , library , true ) )
699- . put ( WorkspaceActions . clearReplOutput ( workspaceLocation ) )
700- . call ( showSuccessMessage , `Switched to ${ newExternalLibraryName } library` , 1000 )
701- . dispatch ( {
702- type : WorkspaceActions . externalLibrarySelect . type ,
703- payload : {
704- externalLibraryName : newExternalLibraryName ,
705- workspaceLocation
706- }
707- } )
708- . silentRun ( ) ;
698+ return (
699+ expectSaga ( workspaceSaga )
700+ . withState ( newDefaultState )
701+ . put ( WorkspaceActions . changeExternalLibrary ( newExternalLibraryName , workspaceLocation ) )
702+ // beginClearContext is asserted here but the library object can contain
703+ // runtime-specific fields (like languageOptions). Match only the action
704+ // shape we care about (type, workspaceLocation and shouldInitLibrary)
705+ . put . like ( {
706+ action : {
707+ type : WorkspaceActions . beginClearContext . type ,
708+ payload : { workspaceLocation, shouldInitLibrary : true }
709+ }
710+ } )
711+ . put ( WorkspaceActions . clearReplOutput ( workspaceLocation ) )
712+ . call ( showSuccessMessage , `Switched to ${ newExternalLibraryName } library` , 1000 )
713+ . dispatch ( {
714+ type : WorkspaceActions . externalLibrarySelect . type ,
715+ payload : {
716+ externalLibraryName : newExternalLibraryName ,
717+ workspaceLocation
718+ }
719+ } )
720+ . silentRun ( )
721+ ) ;
709722 } ) ;
710723
711724 test ( 'does not call the above when oldExternalLibraryName === newExternalLibraryName' , ( ) => {
@@ -770,7 +783,8 @@ describe('BEGIN_CLEAR_CONTEXT', () => {
770783 name : newExternalLibraryName ,
771784 symbols
772785 } ,
773- globals
786+ globals,
787+ languageOptions : undefined
774788 } ;
775789
776790 return expectSaga ( workspaceSaga )
0 commit comments