Skip to content

Commit b45ec9c

Browse files
committed
test: cli compile strapi only when not already built
1 parent c0253b5 commit b45ec9c

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

playground/__tests__/cli.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)