@@ -103,12 +103,13 @@ describe('nx-plugin', () => {
103103 } ) ;
104104 } ) ;
105105
106- it ( 'should consider plugin option bin in configuration target' , async ( ) => {
107- const cwd = path . join ( testFileDir , 'configuration-option-bin' ) ;
106+ it ( 'should consider plugin option pluginBin in configuration target' , async ( ) => {
107+ const cwd = path . join ( testFileDir , 'configuration-option-pluginBin' ) ;
108+ const pluginBinPath = `packages/nx-plugin/dist` ;
108109 registerPluginInWorkspace ( tree , {
109110 plugin : '@code-pushup/nx-plugin' ,
110111 options : {
111- bin : 'XYZ' ,
112+ pluginBin : pluginBinPath ,
112113 } ,
113114 } ) ;
114115 await materializeTree ( tree , cwd ) ;
@@ -120,7 +121,7 @@ describe('nx-plugin', () => {
120121 expect ( projectJson . targets ) . toStrictEqual ( {
121122 'code-pushup--configuration' : expect . objectContaining ( {
122123 options : {
123- command : `nx g XYZ :configuration --skipTarget --targetName="code-pushup" --project="${ project } "` ,
124+ command : `nx g ${ pluginBinPath } :configuration --skipTarget --targetName="code-pushup" --project="${ project } "` ,
124125 } ,
125126 } ) ,
126127 } ) ;
@@ -205,12 +206,13 @@ describe('nx-plugin', () => {
205206 ) ;
206207 } ) ;
207208
208- it ( 'should consider plugin option bin in executor target' , async ( ) => {
209- const cwd = path . join ( testFileDir , 'configuration-option-bin' ) ;
209+ it ( 'should consider plugin option pluginBin in executor target' , async ( ) => {
210+ const cwd = path . join ( testFileDir , 'executor-option-pluginBin' ) ;
211+ const pluginBinPath = `packages/nx-plugin/dist` ;
210212 registerPluginInWorkspace ( tree , {
211213 plugin : '@code-pushup/nx-plugin' ,
212214 options : {
213- bin : 'XYZ' ,
215+ pluginBin : pluginBinPath ,
214216 } ,
215217 } ) ;
216218 const { root } = readProjectConfiguration ( tree , project ) ;
@@ -223,13 +225,39 @@ describe('nx-plugin', () => {
223225
224226 expect ( projectJson . targets ) . toStrictEqual ( {
225227 'code-pushup' : expect . objectContaining ( {
226- executor : 'XYZ:cli' ,
228+ executor : `${ pluginBinPath } :cli` ,
229+ } ) ,
230+ } ) ;
231+ } ) ;
232+
233+ it ( 'should consider plugin option cliBin in executor target' , async ( ) => {
234+ const cwd = path . join ( testFileDir , 'executor-option-cliBin' ) ;
235+ const cliBinPath = `packages/cli/dist` ;
236+ registerPluginInWorkspace ( tree , {
237+ plugin : '@code-pushup/nx-plugin' ,
238+ options : {
239+ cliBin : cliBinPath ,
240+ } ,
241+ } ) ;
242+ const { root } = readProjectConfiguration ( tree , project ) ;
243+ generateCodePushupConfig ( tree , root ) ;
244+ await materializeTree ( tree , cwd ) ;
245+
246+ const { code, projectJson } = await nxShowProjectJson ( cwd , project ) ;
247+
248+ expect ( code ) . toBe ( 0 ) ;
249+
250+ expect ( projectJson . targets ) . toStrictEqual ( {
251+ 'code-pushup' : expect . objectContaining ( {
252+ options : {
253+ bin : cliBinPath ,
254+ } ,
227255 } ) ,
228256 } ) ;
229257 } ) ;
230258
231259 it ( 'should consider plugin option projectPrefix in executor target' , async ( ) => {
232- const cwd = path . join ( testFileDir , 'configuration -option-bin ' ) ;
260+ const cwd = path . join ( testFileDir , 'executor -option-projectPrefix ' ) ;
233261 registerPluginInWorkspace ( tree , {
234262 plugin : '@code-pushup/nx-plugin' ,
235263 options : {
0 commit comments