Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(contributing): improve formatting #768

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 69 additions & 35 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ In case you are suggesting a new feature, we will match your idea with our curre
* Fork the **webpack-cli** repo at [https://github.com/webpack/webpack-cli](https://github.com/webpack/webpack-cli).
* `git clone <your-clone-url> && cd webpack-cli`

### Setup with npm
### Using npm

* Install the dependencies and link them:

```bash
npm install
npm link
npm link webpack-cli
```
```bash
npm install
npm link
npm link webpack-cli
```

* Bootstrap all the submodules before building for the first time

Expand All @@ -49,32 +49,21 @@ npm link webpack-cli
npm run build
```

* Run all the tests with:
- `npm run test`

* To test a single CLI (flag) test case:
- `BIN_TEST_CASES_GREP=/myCase jest test/BinTestCases.test.js`

* To test a single CLI (other type of) test case:
- `npx jest path/to/my-test.js`
- You can also install jest globally and run tests without npx:
- `npm i -g jest`
- If you have jest installed globally:
- `jest path/to/my-test.js`
### Using yarn

* To test linting:
- `npm run lint && npm run tslint`

### Setup with yarn
* If you don't have yarn yet:
- `npm install -g yarn`

```bash
npm install -g yarn
```

* Install the dependencies and link them

```bash
yarn
yarn link
yarn link webpack-cli
```
```bash
yarn
yarn link
yarn link webpack-cli
```

* Bootstrap all the submodules before building for the first time

Expand All @@ -83,17 +72,62 @@ yarn link webpack-cli
yarn build
```


## Testing

### Using npm

* Run all the tests with:
- `yarn test`

```bash
npm run test
```

* To test a single CLI (flag) test case:
- `BIN_TEST_CASES_GREP=/myCase jest test/BinTestCases.test.js`
* Test a single CLI test case:

```bash
npx jest path/to/my-test.js
```

* To test a single CLI (other type of) test case:
- `yarn jest path/to/my-test.js`
* You can also install jest globally and run tests without npx:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't suggest to install a package globally. Npx is enough as it comes for free and there's no installation process

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been introduced by #777

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why it is marked as an addition in this PR? Did you rebase your branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for people that want to reuse a scaffold @ematipico instead of re-installing every time. I don't think npx will completely solve that issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO Reusing a scaffold is related to @webpack-cli/init being able work with it's global installation @evenstensberg.

I think for this issue we should just write if the user has global installation of jest then we should run jest without npm for test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ematipico I moved this code to separate setup and testing, it is marked as deleted some lines above


* To test linting:
- `yarn lint && yarn tslint`
```bash
npm i -g jest
jest path/to/my-test.js
```

* You can run the linters:

```bash
npm run lint && npm run tslint
```

### Using yarn

* Run all the tests with:

```bash
yarn test
```

* Test a single CLI test case:

```bash
yarn jest path/to/my-test.js
```

* You can also install jest globally and run tests:

```bash
yarn global add jest
jest path/to/my-test.js
```

* You can run the linters:

```bash
yarn lint && yarn tslint
```

## Editor Config

Expand Down