@@ -11,6 +11,7 @@ import slash from 'slash';
11
11
import Environment from '../src/index.js' ;
12
12
import { execaOutput } from '../src/util/util.js' ;
13
13
import { findPackagesIn , getNpmPaths } from '../src/module-lookup.js' ;
14
+ import { lookupGenerator } from '../src/generator-lookup.js' ;
14
15
15
16
const require = createRequire ( import . meta. url ) ;
16
17
@@ -749,34 +750,34 @@ describe('Environment Resolver', async function () {
749
750
750
751
describe ( 'Find generator' , async ( ) => {
751
752
it ( 'Scoped lookup' , async ( ) => {
752
- const modulePath = Environment . lookupGenerator ( '@dummyscope/scoped:app' ) ;
753
+ const modulePath = lookupGenerator ( '@dummyscope/scoped:app' ) ;
753
754
assert . ok ( modulePath . endsWith ( 'node_modules/@dummyscope/generator-scoped/app/index.js' ) ) ;
754
- const packagePath = Environment . lookupGenerator ( '@dummyscope/scoped:app' , { packagePath : true } ) ;
755
+ const packagePath = lookupGenerator ( '@dummyscope/scoped:app' , { packagePath : true } ) ;
755
756
assert . ok ( packagePath . endsWith ( 'node_modules/@dummyscope/generator-scoped' ) ) ;
756
757
} ) ;
757
758
it ( 'Lookup' , async ( ) => {
758
- const modulePath = Environment . lookupGenerator ( 'extend:support' ) ;
759
+ const modulePath = lookupGenerator ( 'extend:support' ) ;
759
760
assert . ok ( modulePath . endsWith ( 'node_modules/generator-extend/support/index.js' ) ) ;
760
761
761
- const packagePath = Environment . lookupGenerator ( 'extend:support' , {
762
+ const packagePath = lookupGenerator ( 'extend:support' , {
762
763
packagePath : true ,
763
764
} ) ;
764
- const packagePath3 = Environment . lookupGenerator ( 'extend' , {
765
+ const packagePath3 = lookupGenerator ( 'extend' , {
765
766
packagePath : true ,
766
767
} ) ;
767
768
assert . ok ( packagePath . endsWith ( 'node_modules/generator-extend' ) ) ;
768
769
assert . ok ( packagePath3 . endsWith ( 'node_modules/generator-extend' ) ) ;
769
770
} ) ;
770
771
it ( 'Module Lookup' , async ( ) => {
771
- const modulePath = Environment . lookupGenerator ( 'module:app' ) ;
772
+ const modulePath = lookupGenerator ( 'module:app' ) ;
772
773
assert . ok ( modulePath . endsWith ( 'node_modules/generator-module/generators/app/index.js' ) , modulePath ) ;
773
774
774
- const packagePath = Environment . lookupGenerator ( 'module:app' , {
775
+ const packagePath = lookupGenerator ( 'module:app' , {
775
776
packagePath : true ,
776
777
} ) ;
777
778
assert . ok ( packagePath . endsWith ( 'node_modules/generator-module' ) , packagePath ) ;
778
779
779
- const generatorPath = Environment . lookupGenerator ( 'module:app' , {
780
+ const generatorPath = lookupGenerator ( 'module:app' , {
780
781
generatorPath : true ,
781
782
} ) ;
782
783
assert . ok ( generatorPath . endsWith ( 'node_modules/generator-module/generators/' ) , generatorPath ) ;
@@ -811,17 +812,17 @@ describe('Environment Resolver', async function () {
811
812
812
813
describe ( 'Find generator' , async ( ) => {
813
814
it ( 'Module Lookup' , async ( ) => {
814
- const modulePath = Environment . lookupGenerator ( 'module:app' ) ;
815
+ const modulePath = lookupGenerator ( 'module:app' ) ;
815
816
assert . ok ( modulePath . endsWith ( 'node_modules/generator-module/generators/app/index.js' ) ) ;
816
817
817
- const multiplePath = Environment . lookupGenerator ( 'module:app' , {
818
- multiple : true ,
818
+ const multiplePath = lookupGenerator ( 'module:app' , {
819
+ singleResult : false ,
819
820
} ) ;
820
821
assert . equal ( multiplePath . length , 2 ) ;
821
822
assert . ok ( multiplePath [ 0 ] . endsWith ( 'lookup-custom/node_modules/generator-module/generators/app/index.js' ) ) ;
822
823
assert . ok ( multiplePath [ 1 ] . endsWith ( 'lookup-custom/node_modules/foo/node_modules/generator-module/generators/app/index.js' ) ) ;
823
824
824
- const multiplePath2 = Environment . lookupGenerator ( 'module:app' , {
825
+ const multiplePath2 = lookupGenerator ( 'module:app' , {
825
826
singleResult : false ,
826
827
} ) ;
827
828
assert . equal ( multiplePath2 . length , 2 ) ;
0 commit comments