You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+34-5Lines changed: 34 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -31,11 +31,7 @@ Once your changes are ready to submit for review:
31
31
1. Test your changes
32
32
33
33
Run the test suite to make sure that nothing is broken.
34
-
Usually run `npm test` is enough, our CI will take care of running the integration test.
35
-
If you want to run them on your own, you should spin up and Elasticsearch instance via the scripts that you
36
-
can find inside the `scripts` folder, and then run `npm run test:integration`.<br/>
37
-
If you want to run the integration test for the Elastic licensed APIs, you should run the `platinum` script, and
38
-
then run `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`.
34
+
Usually run `npm test` is enough, our CI will take care of running the integration test. If you want to run the integration test yourself, see the *Testing* section below.
39
35
40
36
2. Submit a pull request
41
37
@@ -60,6 +56,39 @@ Once your changes are ready to submit for review:
60
56
but we'll do our best to dedicate it the attention it deserves.
61
57
Your effort is much appreciated!
62
58
59
+
### Code generation
60
+
61
+
The entire content of the API folder is generated as well as the `docs/reference.asciidoc` file.<br/>
62
+
If you want to run the code generation you should run the following command:
63
+
```sh
64
+
node scripts/generate --tag <tag name>
65
+
# or
66
+
node scripts/generate --branch <branch name>
67
+
```
68
+
Then you should copy the content of `api/generated.d.ts` into the `index.d.ts` file *(automate this step would be a nice pr!)*.
69
+
70
+
### Testing
71
+
There are different test scripts, usually during development you only need to run `npm test`, but if you want you can run just a part of the suite, following you will find all the testing scripts and what they do.
72
+
73
+
| Script | Description |
74
+
|---|---|
75
+
|`npm run test:unit`| Runs the content of the `test/unit` folder. |
76
+
|`npm run test:behavior`| Runs the content of the `test/behavior` folder. |
77
+
|`npm run test:types`| Runs the content of the `test/types` folder. |
78
+
|`npm run test:unit -- --cov --coverage-report=html`| Runs the content of the `test/unit` folder and calculates the code coverage. |
79
+
|`npm run test:integration`| Runs the integration test runner.<br/>*Note: it requires a living instance of Elasticsearch.*|
80
+
|`npm run lint`| Run the [linter](https://standardjs.com/). |
81
+
|`npm run lint:fix`| Fixes the lint errors. |
82
+
|`npm test`| Runs lint, unit, behavior, and types test. |
83
+
84
+
#### Integration test
85
+
The integration test are generated on the fly by the runner you will find inside `test/integration`, once you execute it, it will clone the Elasticsearch repository and checkout the correct version to grab the [OSS yaml files](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/test) and the [Elastic licensed yaml files](https://github.com/elastic/elasticsearch/tree/master/x-pack/plugin/src/test/resources/rest-api-spec/test) that will be used for generating the test.
86
+
87
+
Usually this step is executed by CI since it takes some time, but you can easily run this yourself! Just follow this steps:
88
+
1. Boot an Elasticsearch instance, you can do that by running `./scripts/es-docker.sh` or `./scripts/es-docker-platinum.sh`, the first one will work only with the OSS APIs, while the second will work also with the Elastic licensed APIs;
89
+
1. If you are running the OSS test, you should use `npm run test:integration`, otherwise use `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`. You can also pass a `-b` parameter if you want the test to bail out at the first failure: `npm run test:integration -- -b`;
90
+
1. Grab a coffee, it will take some time ;)
91
+
63
92
### Releasing
64
93
65
94
If you have access to make releases, the process is as follows:
0 commit comments