-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Add
_debug=true
to APM docs (#50093)
* [APM] Add `_debug=true` to APM docs * Fix typo
- Loading branch information
Showing
3 changed files
with
70 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
### Useful Github Pull Request commands | ||
|
||
The following commands can be executed by writing them as comments on a pull request: | ||
|
||
- `@elasticmachine merge upstream`: Will merge the upstream (eg. master or 7.x) into the branch. This is useful if a bug has been fixed upstream and the fix is necessary to pass CI checks | ||
- `retest` Re-run the tests. This is useful if a flaky test caused the build to fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
### Visual Studio Code | ||
|
||
When using [Visual Studio Code](https://code.visualstudio.com/) with APM it's best to set up a [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) and add the `x-pack/legacy/plugins/apm` directory, the `x-pack` directory, and the root of the Kibana repository to the workspace. This makes it so you can navigate and search within APM and use the wider workspace roots when you need to widen your search. | ||
|
||
#### Using the Jest extension | ||
|
||
The [vscode-jest extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) is a good way to run your Jest tests inside the editor. | ||
|
||
Some of the benefits of using the extension over just running it in a terminal are: | ||
|
||
• It shows the pass/fail of a test inline in the test file | ||
• It shows the error message in the test file if it fails | ||
• You don’t have to have the terminal process running | ||
• It can automatically update your snapshots when they change | ||
• Coverage mapping | ||
|
||
The extension doesn't really work well if you're trying to use it on all of Kibana or all of X-Pack, but it works well if you configure it to run only on the files in APM. | ||
|
||
If you have a workspace configured as described above you should have: | ||
|
||
```json | ||
"jest.disabledWorkspaceFolders": ["kibana", "x-pack"] | ||
``` | ||
|
||
in your Workspace settings, and: | ||
|
||
```json | ||
"jest.pathToJest": "node scripts/jest.js --testPathPattern=legacy/plugins/apm", | ||
"jest.rootPath": "../../.." | ||
``` | ||
|
||
in the settings for the APM folder. | ||
|
||
#### Jest debugging | ||
|
||
To make the [VSCode debugger](https://vscode.readthedocs.io/en/latest/editor/debugging/) work with Jest (you can set breakpoints in the code and tests and use the VSCode debugger) you'll need the [Node Debug extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.node-debug2) installed and can set up a launch configuration like: | ||
|
||
```json | ||
{ | ||
"type": "node", | ||
"name": "APM Jest", | ||
"request": "launch", | ||
"args": ["--runInBand", "--testPathPattern=legacy/plugins/apm"], | ||
"cwd": "${workspaceFolder}/../../..", | ||
"console": "internalConsole", | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"disableOptimisticBPs": true, | ||
"program": "${workspaceFolder}/../../../scripts/jest.js", | ||
"runtimeVersion": "10.15.2" | ||
} | ||
``` | ||
|
||
(you'll want `runtimeVersion` to match what's in the Kibana root .nvmrc. Depending on your setup, you might be able to remove this line.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters