Skip to content

Commit 2d699c7

Browse files
test: init fails if the directory already exists (#1329)
1 parent 5b3c649 commit 2d699c7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

__e2e__/init.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ afterEach(() => {
3939
cleanupSync(DIR);
4040
});
4141

42+
test('init fails if the directory already exists', () => {
43+
fs.mkdirSync(path.join(DIR, 'TestInit'));
44+
45+
const {stderr} = runCLI(DIR, ['init', 'TestInit'], {expectedFailure: true});
46+
expect(stderr).toBe(
47+
'error Cannot initialize new project because directory "TestInit" already exists.',
48+
);
49+
});
50+
4251
test('init --template fails without package name', () => {
4352
const {stderr} = runCLI(
4453
DIR,

0 commit comments

Comments
 (0)