Skip to content

Commit

Permalink
test: Add the sidebar file already exists test
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored and jamesgeorge007 committed Jan 22, 2021
1 parent 916479a commit ff2c4c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions e2e/commands/generate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ test('generate _sidebar.md', t => {
run(['generate', 'docs'], {cwd: genPath})
// Check for existence
t.true(fs.existsSync(path.join(docsPath, '_sidebar.md')))

const {stderr} = run(['generate', 'docs'], {cwd: genPath})
t.is(stderr, 'The sidebar file \'_sidebar.md\' already exists.')
})
2 changes: 1 addition & 1 deletion lib/commands/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function (path = '', sidebar) {
return true
}

console.error(chalk.red(`${sidebarPath}`) + ' already exists.')
console.error(chalk.red(`The sidebar file '${sidebar}' already exists.`))
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function (path = '', local, theme) {
const cwdPath = cwd(path || '.')

if (exists(cwdPath)) {
console.log(chalk.red(`${path || '.'}`) + ' already exists.')
console.log(chalk.red(`${path || '.'} already exists.`))

prompt({
type: 'confirm',
Expand Down

0 comments on commit ff2c4c1

Please sign in to comment.