@@ -183,6 +183,41 @@ test(
183183 TEST_TIMEOUT ,
184184) ;
185185
186+ test (
187+ 'Create a function when rootDir and CDK_OUTDIR are relative paths' ,
188+ async ( ) => {
189+ const relativeRootDir = path . relative (
190+ process . cwd ( ) ,
191+ path . join ( resourcesPath , 'basic_app' ) ,
192+ ) ;
193+ const relativeOutDir = path . relative (
194+ process . cwd ( ) ,
195+ process . env . CDK_OUTDIR as string ,
196+ ) ;
197+
198+ process . env . CDK_OUTDIR = relativeOutDir ;
199+ const { app, stack } = await createStack ( 'relative-paths' ) ;
200+
201+ new PythonFunction ( stack , 'basic_app_relative' , {
202+ rootDir : relativeRootDir ,
203+ index : 'handler.py' ,
204+ handler : 'lambda_handler' ,
205+ runtime : Runtime . PYTHON_3_12 ,
206+ architecture : await getDockerHostArch ( ) ,
207+ } ) ;
208+
209+ const template = Template . fromStack ( stack ) ;
210+ const functions = Object . values (
211+ template . findResources ( 'AWS::Lambda::Function' ) ,
212+ ) ;
213+
214+ expect ( functions ) . toHaveLength ( 1 ) ;
215+ const contents = await getFunctionAssetContents ( functions [ 0 ] , app ) ;
216+ expect ( contents ) . toContain ( 'handler.py' ) ;
217+ } ,
218+ TEST_TIMEOUT ,
219+ ) ;
220+
186221test ( 'Reuse one builder container for compatible functions' , async ( ) => {
187222 const { stack } = await createStack ( 'shared' ) ;
188223 const architecture = await getDockerHostArch ( ) ;
0 commit comments