@@ -23,6 +23,16 @@ describe('install/uninstall integration tests', () => {
2323 const otherPlugin = '@oclif/plugin-search'
2424 const otherPluginShortName = 'search'
2525
26+ const yetAnotherPlugin = '@oclif/plugin-update'
27+ const yetAnotherPluginShortName = 'update'
28+ let yetAnotherLocalPluginTarball = resolve ( __dirname , '..' , 'fixtures' , 'oclif-plugin-update-v4.7.31.tgz' )
29+ // Normalize the path to ensure Windows compatibility
30+ . replaceAll ( '\\' , '/' )
31+ // If the path starts with 'C:', that needs to be removed
32+ if ( yetAnotherLocalPluginTarball . startsWith ( 'C:' ) ) {
33+ yetAnotherLocalPluginTarball = yetAnotherLocalPluginTarball . slice ( 2 )
34+ }
35+
2636 const tmp = resolve ( 'tmp' , 'install-integration' )
2737 const cacheDir = join ( tmp , 'plugin-plugins-tests' , 'cache' )
2838 const configDir = join ( tmp , 'plugin-plugins-tests' , 'config' )
@@ -181,28 +191,39 @@ describe('install/uninstall integration tests', () => {
181191 * and then installed a local tarball whose package name is alphabetically after the previous one, the local tarball
182192 * would silently fail to install.
183193 */
184- it ( 'handles local tarball installed after simple plugin name' , async ( ) => {
194+ it ( 'handles local tarballs installed after simple plugin name' , async ( ) => {
185195 // Install first plugin by its registered name
186196 await runCommand ( `plugins install ${ otherPlugin } ` )
187197 const { result : firstResult , stdout : firstStdout } = await runCommand < Array < { name : string } > > ( 'plugins' )
188198 expect ( firstStdout ) . to . contain ( otherPluginShortName )
189199 expect ( firstResult ?. some ( ( r ) => r . name === otherPlugin ) ) . to . be . true
190200
191- // Install second plugin by a local tarball
192- await runCommand ( `plugins install "file://${ pluginLocalTarball } ` )
201+ // Install a second plugin by a local tarball. This one is alphabetically after the first one.
202+ await runCommand ( `plugins install "file://${ yetAnotherLocalPluginTarball } " ` )
193203 const { result : secondResult , stdout : secondStdout } = await runCommand < Array < { name : string } > > ( 'plugins' )
194- expect ( secondStdout ) . to . contain ( pluginShortName )
204+ console . log ( `stdout: ${ secondStdout } ` )
205+ expect ( secondStdout ) . to . contain ( yetAnotherPluginShortName )
195206 expect ( secondResult ?. some ( ( r ) => r . name === otherPlugin ) ) . to . be . true
196- expect ( secondResult ?. some ( ( r ) => r . name === plugin ) ) . to . be . true
207+ expect ( secondResult ?. some ( ( r ) => r . name === yetAnotherPlugin ) ) . to . be . true
208+
209+ // Install a third plugin by a local tarball. This one is alphabetically after the second one.
210+ await runCommand ( `plugins install "file://${ pluginLocalTarball } ` )
211+ const { result : thirdResult , stdout : thirdStdout } = await runCommand < Array < { name : string } > > ( 'plugins' )
212+ expect ( thirdStdout ) . to . contain ( pluginShortName )
213+ expect ( thirdResult ?. some ( ( r ) => r . name === otherPlugin ) ) . to . be . true
214+ expect ( thirdResult ?. some ( ( r ) => r . name === yetAnotherPlugin ) ) . to . be . true
215+ expect ( thirdResult ?. some ( ( r ) => r . name === plugin ) ) . to . be . true
197216 } )
198217
199218 it ( 'uninstalls all plugins' , async ( ) => {
200219 await runCommand ( `plugins uninstall ${ plugin } ` )
201220 await runCommand ( `plugins uninstall ${ otherPlugin } ` )
221+ await runCommand ( `plugins uninstall ${ yetAnotherPlugin } ` )
202222 const { result, stdout} = await runCommand < Array < { name : string } > > ( 'plugins' )
203223 expect ( stdout ) . to . contain ( 'No plugins installed.' )
204224 expect ( result ?. some ( ( r ) => r . name === plugin ) ) . to . be . false
205225 expect ( result ?. some ( ( r ) => r . name === otherPlugin ) ) . to . be . false
226+ expect ( result ?. some ( ( r ) => r . name === yetAnotherPlugin ) ) . to . be . false
206227 } )
207228 } )
208229
0 commit comments