@@ -7,13 +7,15 @@ tmp.setGracefulCleanup();
77const outerPackageJson = {
88 config : {
99 mongodbMemoryServer : {
10+ inner : false ,
1011 version : '3.0.0' ,
1112 } ,
1213 } ,
1314} ;
1415const innerPackageJson = {
1516 config : {
1617 mongodbMemoryServer : {
18+ inner : true ,
1719 version : '4.0.0' ,
1820 } ,
1921 } ,
@@ -57,24 +59,27 @@ describe('resolveConfig', () => {
5759 } ) ;
5860
5961 test ( 'in project' , ( ) => {
62+ // expect to get the outer package.json
6063 process . chdir ( `${ tmpObj . name } /project` ) ;
61- findPackageJson ( ) ;
62- const got = resolveConfig ( ResolveConfigVariables . VERSION ) ;
63- expect ( got ) . toBe ( '3.0.0' ) ;
64+ const out = findPackageJson ( ) ;
65+ expect ( resolveConfig ( ResolveConfigVariables . VERSION ) ) . toBe ( '3.0.0' ) ;
66+ expect ( out . inner ) . toBe ( false ) ;
6467 } ) ;
6568
6669 test ( 'in subproject' , ( ) => {
70+ // expect to get the inner package.json
6771 process . chdir ( `${ tmpObj . name } /project/subproject` ) ;
68- findPackageJson ( ) ;
69- const got = resolveConfig ( ResolveConfigVariables . VERSION ) ;
70- expect ( got ) . toBe ( '4.0.0' ) ;
72+ const out = findPackageJson ( ) ;
73+ expect ( resolveConfig ( ResolveConfigVariables . VERSION ) ) . toBe ( '4.0.0' ) ;
74+ expect ( out . inner ) . toBe ( true ) ;
7175 } ) ;
7276
7377 test ( 'with explicit directory in reInitializePackageJson' , ( ) => {
78+ // expect to get the inner package.json
7479 process . chdir ( `${ tmpObj . name } /project` ) ;
75- findPackageJson ( `${ tmpObj . name } /project/subproject` ) ;
76- const got = resolveConfig ( ResolveConfigVariables . VERSION ) ;
77- expect ( got ) . toBe ( '4.0.0' ) ;
80+ const out = findPackageJson ( `${ tmpObj . name } /project/subproject` ) ;
81+ expect ( resolveConfig ( ResolveConfigVariables . VERSION ) ) . toBe ( '4.0.0' ) ;
82+ expect ( out . inner ) . toBe ( true ) ;
7883 } ) ;
7984 } ) ;
8085} ) ;
0 commit comments