@@ -58,4 +58,47 @@ 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 ( 'mv dist .tmp' ) ;
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+ // We restore the dist folder.
74+ await exec ( 'rm -rf dist' ) ;
75+ await exec ( 'mv .tmp/dist ./dist' ) ;
76+
77+ } ) ;
78+ test ( 'Import project already built' , async ( ) => {
79+
80+
81+ // First we make sure the dist folder exists by doing an import.
82+ await exec ( 'yarn cs import -y' ) ;
83+
84+ const { stdout : lsDist } = await exec ( 'ls dist' ) ;
85+ expect ( lsDist ) . toContain ( 'config' ) ;
86+ expect ( lsDist ) . toContain ( 'src' ) ;
87+ expect ( lsDist ) . toContain ( 'tsconfig.tsbuildinfo' ) ;
88+
89+ // We remove on file from the dist folder
90+ await exec ( 'mv dist/tsconfig.tsbuildinfo .tmp' ) ;
91+
92+ // The new import should not rebuild the project.
93+ await exec ( 'yarn cs import -y' ) ;
94+
95+ const { stdout : buildOutput } = await exec ( 'ls dist' ) ;
96+ expect ( buildOutput ) . toContain ( 'config' ) ;
97+ expect ( buildOutput ) . toContain ( 'src' ) ;
98+ expect ( buildOutput ) . not . toContain ( 'tsconfig.tsbuildinfo' ) ;
99+
100+ // We restore the tsconfig.tsbuildinfo file.
101+ await exec ( 'mv .tmp/tsconfig.tsbuildinfo dist/tsconfig.tsbuildinfo' ) ;
102+
103+ } ) ;
61104} ) ;
0 commit comments