Skip to content

Commit

Permalink
Add test for xo --init (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmgImAlexis authored and sindresorhus committed May 2, 2017
1 parent d7ce41e commit 8e2ed21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ node_modules
!test/fixtures/project/node_modules
.nyc_output
coverage
yarn.lock
9 changes: 9 additions & 0 deletions test/cli.js
Expand Up @@ -74,3 +74,12 @@ test('quiet option', async t => {
const err = await t.throws(cli(['--no-local', '--quiet', '--reporter=compact', filepath]));
t.is(err.stdout.indexOf('warning'), -1);
});

test('init option', async t => {
const filepath = await tempWrite('{}', 'package.json');
await execa(path.join(__dirname, '../cli.js'), ['--init'], {
cwd: path.dirname(filepath)
});
const packageJson = fs.readFileSync(filepath, 'utf8');
t.deepEqual(JSON.parse(packageJson).scripts, {test: 'xo'});
});

0 comments on commit 8e2ed21

Please sign in to comment.