@@ -11,9 +11,11 @@ import { rimraf } from '@nx-dotnet/utils';
1111
1212import executor from './executor' ;
1313import { PublishExecutorSchema } from './schema' ;
14+ import { isAbsolute } from 'path' ;
1415
1516const options : PublishExecutorSchema = {
1617 configuration : 'Debug' ,
18+ output : 'dist/hello-world' ,
1719} ;
1820
1921const root = process . cwd ( ) + '/tmp' ;
@@ -118,4 +120,21 @@ describe('Publish Executor', () => {
118120 expect ( normalizePath ( dotnetClient . cwd || '' ) ) . toEqual ( directoryPath ) ;
119121 expect ( res . success ) . toBeTruthy ( ) ;
120122 } ) ;
123+
124+ it ( 'passes an absolute output path' , async ( ) => {
125+ const spy = jest . spyOn ( dotnetClient , 'publish' ) ;
126+ const directoryPath = joinPathFragments ( root , './apps/my-app' ) ;
127+ try {
128+ await fs . mkdir ( directoryPath , { recursive : true } ) ;
129+ await Promise . all ( [ fs . writeFile ( `${ directoryPath } /1.csproj` , '' ) ] ) ;
130+ } catch ( e ) {
131+ console . warn ( e . message ) ;
132+ }
133+ const res = await executor ( options , context , dotnetClient ) ;
134+ expect ( spy ) . toHaveBeenCalled ( ) ;
135+ const outputFlag = spy . mock . calls [ 0 ] [ 1 ] ?. find ( ( x ) => x . flag === 'output' ) ;
136+ expect ( outputFlag ) . toBeTruthy ( ) ;
137+ expect ( outputFlag && isAbsolute ( outputFlag . value as string ) ) . toBeTruthy ( ) ;
138+ expect ( res . success ) . toBeTruthy ( ) ;
139+ } ) ;
121140} ) ;
0 commit comments