From b45ec9c8d105ab0dcc102104b149b0bba6e53295 Mon Sep 17 00:00:00 2001 From: gboutte Date: Sat, 28 Jun 2025 17:37:38 +0200 Subject: [PATCH] test: cli compile strapi only when not already built --- playground/__tests__/cli.test.js | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/playground/__tests__/cli.test.js b/playground/__tests__/cli.test.js index e15f4f3..1b1c7bf 100644 --- a/playground/__tests__/cli.test.js +++ b/playground/__tests__/cli.test.js @@ -58,4 +58,40 @@ describe('Test the config-sync CLI', () => { } expect(error).toHaveProperty('code', 1); }); + + test('Import build project', async () => { + // First we make sure the dist folder is deleted. + await exec('rm -rf dist'); + + await exec('yarn cs import -y'); + + const { stdout: buildOutput } = await exec('ls dist'); + expect(buildOutput).toContain('config'); + expect(buildOutput).toContain('src'); + expect(buildOutput).toContain('tsconfig.tsbuildinfo'); + + }); + test('Import project already built', async () => { + + + // First we make sure the dist folder exists by doing an import. + await exec('yarn cs import -y'); + + const { stdout: lsDist } = await exec('ls dist'); + expect(lsDist).toContain('config'); + expect(lsDist).toContain('src'); + expect(lsDist).toContain('tsconfig.tsbuildinfo'); + + // We remove on file from the dist folder + await exec('mv dist/tsconfig.tsbuildinfo .tmp'); + + // The new import should not rebuild the project. + await exec('yarn cs import -y'); + + const { stdout: buildOutput } = await exec('ls dist'); + expect(buildOutput).toContain('config'); + expect(buildOutput).toContain('src'); + expect(buildOutput).not.toContain('tsconfig.tsbuildinfo'); + + }); });