@@ -172,6 +172,38 @@ describe('services', () => {
172172 } ) ;
173173 } ) ;
174174
175+ describe ( 'getWorkingDirectory' , ( ) => {
176+ it ( 'should return working directory when provided in config' , ( ) => {
177+ const workingDir = '/path/to/project' ;
178+ const config = createMockResolvedConfig ( { startDir : workingDir } ) ;
179+ const services = new Services ( { resolvedConfig : config } ) ;
180+
181+ expect ( services . getWorkingDirectory ( ) ) . to . equal ( workingDir ) ;
182+ } ) ;
183+
184+ it ( 'should fall back to process.cwd() when not provided' , ( ) => {
185+ const config = createMockResolvedConfig ( ) ;
186+ const services = new Services ( { resolvedConfig : config } ) ;
187+
188+ expect ( services . getWorkingDirectory ( ) ) . to . equal ( process . cwd ( ) ) ;
189+ } ) ;
190+
191+ it ( 'should return working directory from fromResolvedConfig when provided in config' , ( ) => {
192+ const workingDir = '/path/to/project' ;
193+ const config = createMockResolvedConfig ( { startDir : workingDir } ) ;
194+ const services = Services . fromResolvedConfig ( config ) ;
195+
196+ expect ( services . getWorkingDirectory ( ) ) . to . equal ( workingDir ) ;
197+ } ) ;
198+
199+ it ( 'should fall back to process.cwd() from fromResolvedConfig when not provided in config' , ( ) => {
200+ const config = createMockResolvedConfig ( ) ;
201+ const services = Services . fromResolvedConfig ( config ) ;
202+
203+ expect ( services . getWorkingDirectory ( ) ) . to . equal ( process . cwd ( ) ) ;
204+ } ) ;
205+ } ) ;
206+
175207 describe ( 'getHomeDir' , ( ) => {
176208 it ( 'should return home directory' , ( ) => {
177209 const config = createMockResolvedConfig ( ) ;
0 commit comments