Skip to content

Commit

Permalink
Replace --init flag with npx recommendation
Browse files Browse the repository at this point in the history
* Remove --init flag
* Move from ava-init to @ava/init
  • Loading branch information
billyjanitsch authored and novemberborn committed Mar 26, 2018
1 parent 84a884e commit 3311d69
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 87 deletions.
4 changes: 2 additions & 2 deletions docs/recipes/debugging-with-webstorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Save the configuration.

## Setup using npm

Execute `ava --init` in your project directory to add AVA to your `package.json`.
Execute `npx @ava/init` in your project directory to add AVA to your `package.json`.

Your `package.json` will look something like this:

Expand All @@ -46,7 +46,7 @@ Your IDE will then execute `npm run test` and thus call `node_modules/.bin/ava`

In the `Node parameters`, for Node.js 7+ pass `--inspect-brk` or `--debug-brk` for earlier versions.

Don't forget to select a Node.js interpreter.
Don't forget to select a Node.js interpreter.

Save the configuration.

Expand Down
10 changes: 0 additions & 10 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exports.run = () => {
ava [<file|directory|glob> ...]
Options
--init Add AVA to your project
--watch, -w Re-run tests when tests and source files change
--match, -m Only run tests with matching title (Can be repeated)
--update-snapshots, -u Update snapshots
Expand All @@ -49,15 +48,11 @@ exports.run = () => {
ava test.js test2.js
ava test-*.js
ava test
ava --init
Default patterns when no arguments:
test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js
`, {
flags: {
init: {
type: 'boolean'
},
watch: {
type: 'boolean',
alias: 'w'
Expand Down Expand Up @@ -116,11 +111,6 @@ exports.run = () => {

updateNotifier({pkg: cli.pkg}).notify();

if (cli.flags.init) {
require('ava-init')();
return;
}

if (cli.flags.watch && cli.flags.tap && !conf.tap) {
throw new Error(`${colors.error(figures.cross)} The TAP reporter is not available when using watch mode.`);
}
Expand Down
76 changes: 13 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"array-uniq": "^1.0.2",
"arrify": "^1.0.0",
"auto-bind": "^1.2.0",
"ava-init": "^0.2.1",
"bluebird": "^3.5.1",
"caching-transform": "^1.0.0",
"chalk": "^2.3.1",
Expand Down
24 changes: 13 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,10 @@ test('arrays are equal', t => {

### Add AVA to your project

Install AVA and run it with `--init` to add AVA to your `package.json`:
To install and set up AVA, run:

```console
$ npm install ava@next --save-dev
$ npx ava --init
```

If you prefer using [Yarn](https://yarnpkg.com/en/):

```console
$ yarn add --dev ava@next
$ yarn run ava --init
$ npx @ava/init --next
```

Your `package.json` will then look like this:
Expand All @@ -100,7 +92,17 @@ Your `package.json` will then look like this:
}
```

Running `npx` requires [`npm@5.2.0`](https://github.com/npm/npm/releases/tag/v5.2.0) or greater. Otherwise, you'll have to manually configure the `test` script in your `package.json` to use `ava` (see above).
Initialization will work with npm and Yarn, but running `npx` requires [`npm@5.2.0`](https://github.com/npm/npm/releases/tag/v5.2.0) or greater to be installed. Otherwise, you'll have to manually install `ava` and configure the `test` script in your `package.json` as per above:

```console
$ npm install --save-dev ava@next
```

Or if you prefer using Yarn:

```console
$ yarn add --dev ava@next
```

### Create your test file

Expand Down

0 comments on commit 3311d69

Please sign in to comment.