Skip to content

Commit

Permalink
chore: update contributing guide and the PR template (#1402)
Browse files Browse the repository at this point in the history
Co-authored-by: Lorna Jane Mitchell <[email protected]>
  • Loading branch information
tatomyr and lornajane authored Jan 25, 2024
1 parent d95bef1 commit 0a65c35
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

## Screenshots (optional)

## Check yourself
## Has code been changed?

- [ ] Code is linted
- [ ] Tested with redoc/reference-docs/workflows (internal)
- [ ] All new/updated code is covered with tests

Expand Down
46 changes: 17 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Before submitting a pull request, please make sure the following is done:

1. Fork the repository and create your branch from `main`.
1. Run `npm install` in the repository root.
1. If you’ve fixed a bug or added code that should be tested, don't forget to add tests!
1. Ensure the test suite passes (`npm run test` and `npm run e2e`). Tip: to run a specific test, use this command: `npm run unit -- -t 'Test name'`. To update snapshots, run `npm run unit -- -u` for unit tests or `npm run e2e -- -u` for e2e tests.
1. If you’ve fixed a bug or added code that should be tested, don't forget to add [tests](#tests)!
1. Ensure the test suite passes (see the [Tests section](#tests) for more details).
1. Format your code with prettier (`npm run prettier`).
1. Each feat/fix PR should also contain a changeset (to create one, run `npx changeset`; if your changes are scoped to `packages/core` but also affect Redocly CLI behavior, please include the `@redocly/cli` package as well). Please describe what you've done in this PR using sentence case (you can refer to our [changelog](https://redocly.com/docs/cli/changelog/)). This produces a file in `.changeset` folder. Please commit this file along with your changes.

Expand All @@ -45,36 +45,13 @@ npm install # or npm i

### Commonly used NPM scripts

```bash
# run a separate CLI command
$ npm run <command>

# run a compile of packages
$ npm run compile

# synchronously pick-up the changes made to the packages
$ npm run watch

# run the CLI package
$ npm run cli

# run the unit tests with typecheck
$ npm test

# run the unit tests (includes coverage report)
$ npm run unit
To compile the code, run `npm run compile`. To do that on the fly, run `npm run watch` in a separate thread.

# run e2e tests
$ npm run e2e
# Make sure you have compiled the code before running e2e test
# E.g. run `npm run compile` and wait for the finishing process or run `npm run watch`.
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint openapi.yaml --format=stylish`. Please notice that the extra `--` is required to pass arguments to the CLI rather than the NPM itself.

# format the code using prettier
$ npm run prettier
Format your code with `npm run prettier` before committing.

# run basic perf benchmark
$ npm run benchmark
```
Please check the [Tests section](#tests) for the test commands reference.

There are some other scripts available in the `scripts` section of the `package.json` file.

Expand Down Expand Up @@ -173,14 +150,25 @@ The application maintains the following exit codes.

### Unit tests

Run unit tests with this command: `npm run test`.

Unit tests in the **cli** package are sensitive to top-level configuration file (**redocly.yaml**).

To run a specific test, use this command: `npm run unit -- -t 'Test name'`.
To update snapshots, run `npm run unit -- -u`.

To get coverage per package run `npm run coverage:cli` or `npm run coverage:core`.

### E2E tests

Run e2e tests with this command: `npm run e2e`.

E2E tests are sensitive to any additional output (like `console.log`) in the source code.

To update snapshots, run `npm run e2e -- -u`.

If you made any changes, make sure to compile the code before running the tests.

## Project structure

- **`__mocks__`**: contains basic mocks for e2e tests.
Expand Down

1 comment on commit 0a65c35

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.8% 4100/5409
🟡 Branches 66.07% 2183/3304
🟡 Functions 68.14% 663/973
🟡 Lines 76% 3847/5062

Test suite run success

671 tests passing in 94 suites.

Report generated by 🧪jest coverage report action from 0a65c35

Please sign in to comment.