@@ -58,4 +58,40 @@ describe('Test the config-sync CLI', () => {
5858 }
5959 expect ( error ) . toHaveProperty ( 'code' , 1 ) ;
6060 } ) ;
61+
62+ test ( 'Import build project' , async ( ) => {
63+ // First we make sure the dist folder is deleted.
64+ await exec ( 'rm -rf dist' ) ;
65+
66+ await exec ( 'yarn cs import -y' ) ;
67+
68+ const { stdout : buildOutput } = await exec ( 'ls dist' ) ;
69+ expect ( buildOutput ) . toContain ( 'config' ) ;
70+ expect ( buildOutput ) . toContain ( 'src' ) ;
71+ expect ( buildOutput ) . toContain ( 'tsconfig.tsbuildinfo' ) ;
72+
73+ } ) ;
74+ test ( 'Import project already built' , async ( ) => {
75+
76+
77+ // First we make sure the dist folder exists by doing an import.
78+ await exec ( 'yarn cs import -y' ) ;
79+
80+ const { stdout : lsDist } = await exec ( 'ls dist' ) ;
81+ expect ( lsDist ) . toContain ( 'config' ) ;
82+ expect ( lsDist ) . toContain ( 'src' ) ;
83+ expect ( lsDist ) . toContain ( 'tsconfig.tsbuildinfo' ) ;
84+
85+ // We remove on file from the dist folder
86+ await exec ( 'mv dist/tsconfig.tsbuildinfo .tmp' ) ;
87+
88+ // The new import should not rebuild the project.
89+ await exec ( 'yarn cs import -y' ) ;
90+
91+ const { stdout : buildOutput } = await exec ( 'ls dist' ) ;
92+ expect ( buildOutput ) . toContain ( 'config' ) ;
93+ expect ( buildOutput ) . toContain ( 'src' ) ;
94+ expect ( buildOutput ) . not . toContain ( 'tsconfig.tsbuildinfo' ) ;
95+
96+ } ) ;
6197} ) ;
0 commit comments