Added instructions to fork the repo in order to setup. (#10973)
* Added instructions to fork the repo to setup * Capitalized Github and Indented the guidelines [skip ci]
This commit is contained in:
parent
bfc56ebbab
commit
3dcb8ca99e
@ -1,4 +1,4 @@
|
||||
----
|
||||
---
|
||||
|
||||
<p align="center" class="toc">
|
||||
<strong><a href="#setup">Setup</a></strong>
|
||||
@ -12,8 +12,7 @@
|
||||
<strong><a href="#internals">Internals</a></strong>
|
||||
</p>
|
||||
|
||||
----
|
||||
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
@ -49,8 +48,12 @@ Installation instructions can be found here: https://yarnpkg.com/en/docs/install
|
||||
|
||||
### Setup
|
||||
|
||||
Fork the `babel` repository to your GitHub Account.
|
||||
|
||||
Then, run:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/babel/babel
|
||||
$ git clone https://github.com/<your-github-username>/babel
|
||||
$ cd babel
|
||||
$ make bootstrap
|
||||
```
|
||||
@ -158,12 +161,12 @@ $ ./scripts/test-cov.sh
|
||||
|
||||
In case you're not able to reproduce an error on CI locally, it may be due to
|
||||
|
||||
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
|
||||
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
|
||||
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
|
||||
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
|
||||
|
||||
In case you're locally getting errors which are not on the CI, it may be due to
|
||||
|
||||
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
|
||||
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
|
||||
|
||||
### Writing tests
|
||||
|
||||
@ -177,6 +180,7 @@ For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https:/
|
||||
|
||||
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
|
||||
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
|
||||
|
||||
- There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
|
||||
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`.
|
||||
- If necessary, you can have an `options.json` with different options in each subfolder.
|
||||
@ -200,6 +204,7 @@ and the expected output after transforming it with your `options.json` in `outpu
|
||||
// output.js
|
||||
Math.pow(2, 2);
|
||||
```
|
||||
|
||||
In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output.
|
||||
|
||||
```js
|
||||
@ -235,9 +240,9 @@ Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings
|
||||
etc.). To add a test, create a folder under one of these groupings (or create a new one) with a
|
||||
descriptive name, and add the following:
|
||||
|
||||
* Create an `input.js` file that contains the code you want the babel parser to parse.
|
||||
- Create an `input.js` file that contains the code you want the babel parser to parse.
|
||||
|
||||
* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
|
||||
- Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
|
||||
|
||||
After writing tests for @babel/parser, just build it by running:
|
||||
|
||||
@ -317,6 +322,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
|
||||
- Start working about the Babel transform itself!
|
||||
|
||||
## Internals
|
||||
|
||||
- AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md))
|
||||
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md))
|
||||
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user