@@ -103,10 +103,15 @@ suite('Workspace Experiments Test Suite', () => {
103103 expect ( mockQuickPickOne ) . to . not . be . called
104104 } )
105105
106- it ( 'should not prompt to pick a project if a params file is focused' , async ( ) => {
106+ it ( 'should not prompt to pick a project if a params file or dvc.yaml is focused' , async ( ) => {
107107 const mockQuickPickOne = stub ( QuickPick , 'quickPickOne' ) . resolves (
108108 dvcDemoPath
109109 )
110+ const mockRunExperiment = stub (
111+ DvcRunner . prototype ,
112+ 'runExperiment'
113+ ) . resolves ( undefined )
114+ stub ( DvcReader . prototype , 'listStages' ) . resolves ( 'train' )
110115
111116 const { workspaceExperiments, experiments } =
112117 buildMultiRepoExperiments ( disposable )
@@ -119,32 +124,37 @@ suite('Workspace Experiments Test Suite', () => {
119124
120125 expect ( await focusedWebview ) . to . equal ( dvcDemoPath )
121126
122- const focusedParamsFile = new Promise ( resolve => {
123- const listener : Disposable = experiments . onDidChangeIsParamsFileFocused (
124- ( event : string | undefined ) => {
125- listener . dispose ( )
126- return resolve ( event )
127- }
128- )
129- } )
127+ const getDvcRootFocusedEvent = ( ) =>
128+ new Promise ( resolve => {
129+ const listener : Disposable =
130+ experiments . onDidChangeIsExperimentsFileFocused (
131+ ( event : string | undefined ) => {
132+ listener . dispose ( )
133+ return resolve ( event )
134+ }
135+ )
136+ } )
130137
131- const paramsFile = Uri . file ( join ( dvcDemoPath , 'params.yaml' ) )
132- await window . showTextDocument ( paramsFile )
138+ const testFile = async ( path : string ) => {
139+ const focusedDvcRoot = getDvcRootFocusedEvent ( )
140+ const uri = Uri . file ( join ( dvcDemoPath , path ) )
141+ await window . showTextDocument ( uri )
133142
134- expect ( await focusedParamsFile ) . to . equal ( dvcDemoPath )
143+ expect ( await focusedDvcRoot ) . to . equal ( dvcDemoPath )
135144
136- mockQuickPickOne . resetHistory ( )
145+ mockQuickPickOne . resetHistory ( )
137146
138- const mockRunExperiment = stub (
139- DvcRunner . prototype ,
140- 'runExperiment'
141- ) . resolves ( undefined )
147+ await workspaceExperiments . getCwdThenRun (
148+ AvailableCommands . EXPERIMENT_RUN
149+ )
142150
143- stub ( DvcReader . prototype , 'listStages' ) . resolves ( 'train' )
144- await workspaceExperiments . getCwdThenRun ( AvailableCommands . EXPERIMENT_RUN )
151+ expect ( mockQuickPickOne ) . not . to . be . called
152+ expect ( mockRunExperiment ) . to . be . calledWith ( dvcDemoPath )
153+ return closeAllEditors ( )
154+ }
145155
146- expect ( mockQuickPickOne ) . not . to . be . calledOnce
147- expect ( mockRunExperiment ) . to . be . calledWith ( dvcDemoPath )
156+ await testFile ( 'params.yaml' )
157+ await testFile ( 'dvc.yaml' )
148158 } )
149159 } ) . timeout ( WEBVIEW_TEST_TIMEOUT )
150160
0 commit comments