Skip to content

Commit

Permalink
Merge branch 'main' of github.com:caoxiemeihao/create-electron-vite i…
Browse files Browse the repository at this point in the history
…nto v0.4.0
  • Loading branch information
caoxiemeihao committed Sep 6, 2023
2 parents cd51d75 + e4b1099 commit ac8d5f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion __tests__/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,25 @@ test('prompts for the project name if none supplied', () => {
expect(stdout).toContain('Project name:')
})

test('prompts for project template if none supplied when target dir is current directory', () => {
test('prompts for the framework if none supplied when target dir is current directory', () => {
fs.mkdirSync(generatePath, { recursive: true })
const { stdout } = run(['.'], { cwd: generatePath })
expect(stdout).toContain('Project template:')
})

test('prompts for the framework if none supplied', () => {
const { stdout } = run([projectName])
expect(stdout).toContain('Project template:')
})

test('asks to overwrite non-empty target directory', () => {
createNonEmptyDir()
const { stdout } = run([projectName], { cwd: __dirname })
expect(stdout).toContain(`Target directory "${projectName}" is not empty.`)
})

test('asks to overwrite non-empty current directory', () => {
createNonEmptyDir()
const { stdout } = run(['.'], { cwd: generatePath })
expect(stdout).toContain(`Current directory is not empty.`)
})
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"starter"
],
"scripts": {
"preinstall": "npx only-allow pnpm",
"watch": "vite build --watch",
"build": "vite build",
"prepublishOnly": "npm run build && npm run test",
Expand All @@ -50,5 +51,6 @@
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
}
},
"packageManager": "[email protected]"
}

0 comments on commit ac8d5f7

Please sign in to comment.