Repository: elastic/synthetics
Pull request #231 (2021-03-01 10:17:00)

expose step status field via step and journey
Fixes: https://github.com/elastic/synthetics/issues/230

Exposed status field for step/end and journey/end documents being sent to heartbeat

apmmachine: 
## :broken_heart: Build Failed


<!-- BUILD BADGES-->
> _the below badges are clickable and redirect to their specific view in the CI or DOCS_
[![Pipeline View](https://img.shields.io/badge/pipeline-pipeline%20-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-231/detail/PR-231/1//pipeline) [![Test View](https://img.shields.io/badge/test-test-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-231/detail/PR-231/1//tests) [![Changes](https://img.shields.io/badge/changes-changes-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-231/detail/PR-231/1//changes) [![Artifacts](https://img.shields.io/badge/artifacts-artifacts-yellow)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-231/detail/PR-231/1//artifacts) [![preview](https://img.shields.io/badge/docs-preview-yellowgreen)](http://synthetics_231.docs-preview.app.elstc.co/diff)

<!-- BUILD SUMMARY-->
<details><summary>Expand to view the summary</summary>
<p>

#### Build stats


* Build Cause: `Pull request #231 opened`



* Start Time: 2021-03-01T10:17:13.261+0000


* Duration: 9 min 37 sec


* Commit: cafb4f8e482fd1bfabfd42aacdac77e74f0961eb




#### Trends :test_tube:


![Image of Build Times](https://apm-ci.elastic.co/job/apm-agent-rum/job/elastic-synthetics/job/PR-231/buildTimeGraph/png)



</p>
</details>

<!-- TEST RESULTS IF ANY-->


<!-- STEPS ERRORS IF ANY -->









### Steps errors [![2](https://img.shields.io/badge/2%20-red)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-231/detail/PR-231/1//pipeline)
  <details><summary>Expand to view the steps failures</summary>
  <p>


  
  
  
  
##### `Install precommit hooks`
<ul>
<li>Took 0 min 0 sec . View more details on <a href="https://apm-ci.elastic.co//blue/rest/organizations/jenkins/pipelines/apm-agent-rum/pipelines/elastic-synthetics/pipelines/PR-231/runs/1/steps/206/log/?start=0">here</a></li>
<li>Description: <code>          export PATH=/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin:/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.nvm/versions/node/v14.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin          ## Install with the hooks therefore ~/.cache/pre-commit will be created with the repos          pre-commit install --install-hooks        </code></l1>
</ul>
  
  
  
  
##### `Install precommit hooks`
<ul>
<li>Took 0 min 0 sec . View more details on <a href="https://apm-ci.elastic.co//blue/rest/organizations/jenkins/pipelines/apm-agent-rum/pipelines/elastic-synthetics/pipelines/PR-231/runs/1/steps/210/log/?start=0">here</a></li>
<li>Description: <code>          export PATH=/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin:/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.nvm/versions/node/v14.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin          ## Install with the hooks therefore ~/.cache/pre-commit will be created with the repos          pre-commit install --install-hooks        </code></l1>
</ul>
  
  </p>
  </details>



<!-- LOG OUTPUT-->
### Log output

<details><summary>Expand to view the last 100 lines of log output</summary>
<p>

```
[2021-03-01T10:25:26.803Z] Collecting typing; python_version < "3.5"
[2021-03-01T10:25:26.803Z]   Downloading typing-3.7.4.3-py2-none-any.whl (26 kB)
[2021-03-01T10:25:26.803Z] Collecting singledispatch; python_version < "3.4"
[2021-03-01T10:25:26.803Z]   Downloading singledispatch-3.6.1-py2.py3-none-any.whl (9.5 kB)
[2021-03-01T10:25:27.067Z] Collecting scandir; python_version < "3.5"
[2021-03-01T10:25:27.067Z]   Downloading scandir-1.10.0.tar.gz (33 kB)
[2021-03-01T10:25:27.067Z] Building wheels for collected packages: filelock, scandir
[2021-03-01T10:25:27.328Z]   Building wheel for filelock (setup.py): started
[2021-03-01T10:25:27.328Z]   Building wheel for filelock (setup.py): finished with status 'done'
[2021-03-01T10:25:27.328Z]   Created wheel for filelock: filename=filelock-3.0.12-py2-none-any.whl size=7576 sha256=63baf920c74330352dc2dc8cbccca0f2f3a7733949dc1fbd96eeeb71ca4853b9
[2021-03-01T10:25:27.328Z]   Stored in directory: /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.cache/pip/wheels/b9/91/23/b559c1f4fd55056712b3a71cd9cab1dc0089e2232d502ed72e
[2021-03-01T10:25:27.328Z]   Building wheel for scandir (setup.py): started
[2021-03-01T10:25:28.270Z]   Building wheel for scandir (setup.py): finished with status 'done'
[2021-03-01T10:25:28.270Z]   Created wheel for scandir: filename=scandir-1.10.0-cp27-cp27mu-linux_x86_64.whl size=33233 sha256=236ecfd48921cd9e9f7b09c81db895398b0249ba7d553cbf4d0ef8dee7189905
[2021-03-01T10:25:28.270Z]   Stored in directory: /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.cache/pip/wheels/58/2c/26/52406f7d1f19bcc47a6fbd1037a5f293492f5cf1d58c539edb
[2021-03-01T10:25:28.270Z] Successfully built filelock scandir
[2021-03-01T10:25:28.270Z] Installing collected packages: futures, pyyaml, aspy.yaml, scandir, six, pathlib2, contextlib2, zipp, configparser, importlib-metadata, typing, singledispatch, importlib-resources, appdirs, distlib, filelock, virtualenv, toml, cfgv, nodeenv, identify, pre-commit
[2021-03-01T10:25:29.211Z] Successfully installed appdirs-1.4.4 aspy.yaml-1.3.0 cfgv-2.0.1 configparser-4.0.2 contextlib2-0.6.0.post1 distlib-0.3.1 filelock-3.0.12 futures-3.3.0 identify-1.6.1 importlib-metadata-2.1.1 importlib-resources-3.3.1 nodeenv-1.5.0 pathlib2-2.3.5 pre-commit-1.21.0 pyyaml-5.4.1 scandir-1.10.0 singledispatch-3.6.1 six-1.15.0 toml-0.10.2 typing-3.7.4.3 virtualenv-20.4.2 zipp-1.2.0
[2021-03-01T10:25:29.211Z] Downloading https://files.pythonhosted.org/packages/a4/e3/1f067de470e3a86875ed915438dc3bd781fb0346254f541190a09472b677/virtualenv-16.7.10.tar.gz
[2021-03-01T10:25:29.211Z] Done.
[2021-03-01T10:25:29.211Z] *******************************************************************************
[2021-03-01T10:25:29.211Z] Installing pre-commit to /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin/pre-commit
[2021-03-01T10:25:29.211Z] *******************************************************************************
[2021-03-01T10:25:29.211Z] It looks like /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin is not on your path
[2021-03-01T10:25:29.211Z] You may want to add it.
[2021-03-01T10:25:29.211Z] Often this does the trick: source ~/.profile
[2021-03-01T10:25:29.618Z] + export PATH=/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin:/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.nvm/versions/node/v14.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[2021-03-01T10:25:29.618Z] + pre-commit install --install-hooks
[2021-03-01T10:25:29.618Z] Traceback (most recent call last):
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin/pre-commit", line 5, in <module>
[2021-03-01T10:25:29.618Z]     from pre_commit.main import main
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/main.py", line 11, in <module>
[2021-03-01T10:25:29.618Z]     from pre_commit import git
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/git.py", line 7, in <module>
[2021-03-01T10:25:29.618Z]     from pre_commit.util import cmd_output
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/util.py", line 15, in <module>
[2021-03-01T10:25:29.618Z]     from pre_commit import parse_shebang
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/parse_shebang.py", line 6, in <module>
[2021-03-01T10:25:29.618Z]     from identify.identify import parse_shebang_from_file
[2021-03-01T10:25:29.618Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/identify/identify.py", line 31
[2021-03-01T10:25:29.618Z]     ALL_TAGS = {*TYPE_TAGS, *MODE_TAGS, *ENCODING_TAGS}
[2021-03-01T10:25:29.618Z]                 ^
[2021-03-01T10:25:29.618Z] SyntaxError: invalid syntax
[2021-03-01T10:25:29.649Z] Sleeping for 5 sec
[2021-03-01T10:25:34.662Z] ERROR: script returned exit code 1
[2021-03-01T10:25:34.662Z] Retrying
[2021-03-01T10:25:35.008Z] + export PATH=/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin:/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.nvm/versions/node/v14.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[2021-03-01T10:25:35.008Z] + pre-commit install --install-hooks
[2021-03-01T10:25:35.008Z] Traceback (most recent call last):
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/bin/pre-commit", line 5, in <module>
[2021-03-01T10:25:35.008Z]     from pre_commit.main import main
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/main.py", line 11, in <module>
[2021-03-01T10:25:35.008Z]     from pre_commit import git
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/git.py", line 7, in <module>
[2021-03-01T10:25:35.008Z]     from pre_commit.util import cmd_output
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/util.py", line 15, in <module>
[2021-03-01T10:25:35.008Z]     from pre_commit import parse_shebang
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/pre_commit/parse_shebang.py", line 6, in <module>
[2021-03-01T10:25:35.008Z]     from identify.identify import parse_shebang_from_file
[2021-03-01T10:25:35.008Z]   File "/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231/.pre-commit-venv/local/lib/python2.7/site-packages/identify/identify.py", line 31
[2021-03-01T10:25:35.008Z]     ALL_TAGS = {*TYPE_TAGS, *MODE_TAGS, *ENCODING_TAGS}
[2021-03-01T10:25:35.008Z]                 ^
[2021-03-01T10:25:35.008Z] SyntaxError: invalid syntax
[2021-03-01T10:25:35.041Z] Sleeping for 10 sec
[2021-03-01T10:25:45.161Z] $ ssh-agent -k
[2021-03-01T10:25:45.165Z] unset SSH_AUTH_SOCK;
[2021-03-01T10:25:45.165Z] unset SSH_AGENT_PID;
[2021-03-01T10:25:45.165Z] echo Agent pid 4417 killed;
[2021-03-01T10:25:45.178Z] [ssh-agent] Stopped.
[2021-03-01T10:25:46.275Z] Stage "Build" skipped due to earlier failure(s)
[2021-03-01T10:25:46.364Z] Stage "Test" skipped due to earlier failure(s)
[2021-03-01T10:25:46.463Z] Stage "E2e Test" skipped due to earlier failure(s)
[2021-03-01T10:25:46.560Z] Stage "Publish Docker image" skipped due to earlier failure(s)
[2021-03-01T10:25:46.704Z] Stage "Matrix - STACK_VERSION = '8.0.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:46.712Z] Stage "Matrix - STACK_VERSION = '7.10.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:46.722Z] Stage "Matrix - STACK_VERSION = '7.11.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:46.806Z] Stage "Matrix - STACK_VERSION = '8.0.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:46.817Z] Stage "Matrix - STACK_VERSION = '7.10.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:46.826Z] Stage "Matrix - STACK_VERSION = '7.11.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.015Z] Stage "Matrix - STACK_VERSION = '8.0.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.028Z] Stage "Matrix - STACK_VERSION = '7.10.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.037Z] Stage "Matrix - STACK_VERSION = '7.11.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.230Z] Stage "Matrix - STACK_VERSION = '8.0.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.243Z] Stage "Matrix - STACK_VERSION = '7.10.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.251Z] Stage "Matrix - STACK_VERSION = '7.11.0-synthetics'" skipped due to earlier failure(s)
[2021-03-01T10:25:47.484Z] Failed in branch Matrix - STACK_VERSION = '8.0.0-synthetics'
[2021-03-01T10:25:47.494Z] Failed in branch Matrix - STACK_VERSION = '7.10.0-synthetics'
[2021-03-01T10:25:47.503Z] Failed in branch Matrix - STACK_VERSION = '7.11.0-synthetics'
[2021-03-01T10:25:47.691Z] Stage "Release" skipped due to earlier failure(s)
[2021-03-01T10:25:47.731Z] Stage "Release" skipped due to earlier failure(s)
[2021-03-01T10:25:47.823Z] Stage "Release" skipped due to earlier failure(s)
[2021-03-01T10:25:49.080Z] Running on worker-1095690 in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-231
[2021-03-01T10:25:49.154Z] [INFO] getVaultSecret: Getting secrets
[2021-03-01T10:25:49.377Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-03-01T10:25:51.469Z] + chmod 755 generate-build-data.sh
[2021-03-01T10:25:51.469Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-231/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-231/runs/1 FAILURE 516806
[2021-03-01T10:25:51.469Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-231/runs/1/steps/?limit=10000 -o steps-info.json
[2021-03-01T10:25:52.167Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-231/runs/1/tests/?status=FAILED -o tests-errors.json
[2021-03-01T10:25:52.866Z] Retry 1/3 exited 22, retrying in 1 seconds...
[2021-03-01T10:25:54.313Z] Retry 2/3 exited 22, retrying in 2 seconds...

```

</p>
</details>



<!--COMMENT_GENERATED_WITH_ID_comment.id-->
shahzad31: can't figure out CI errors :/

Patch:
diff --git a/src/reporters/json.ts b/src/reporters/json.ts
index edf3a84..c071404 100644
--- a/src/reporters/json.ts
+++ b/src/reporters/json.ts
@@ -27,8 +27,9 @@ import BaseReporter from './base';
 import { formatError, getTimestamp } from '../helpers';
 import { Journey, Step } from '../dsl';
 import snakeCaseKeys from 'snakecase-keys';
-import { NetworkInfo } from '../common_types';
+import { NetworkInfo, StatusValue } from '../common_types';
 import { Protocol } from 'playwright-chromium/types/protocol';
+import { Metrics } from '../plugins';
 
 /* eslint-disable @typescript-eslint/no-var-requires */
 const { version, name } = require('../../package.json');
@@ -43,6 +44,19 @@ type OutputType =
   | 'journey/browserconsole'
   | 'journey/end';
 
+type Payload = {
+  source?: string;
+  start?: number;
+  end?: number;
+  url?: string;
+  status?: StatusValue | number;
+  metrics?: Metrics;
+  params?: Record<string, unknown>;
+  type?: OutputType;
+  text?: string;
+  index?: number;
+};
+
 type OutputFields = {
   type: OutputType;
   journey: Journey;
@@ -51,7 +65,7 @@ type OutputFields = {
   step?: Partial<Step>;
   error?: Error;
   root_fields?: Record<string, unknown>;
-  payload?: Record<string, unknown>;
+  payload?: Payload | NetworkInfo;
   blob?: string;
 };
 
@@ -167,7 +181,7 @@ export default class JSONReporter extends BaseReporter {
         type: 'journey/start',
         journey,
         timestamp,
-        payload: { params, source: journey.callback.toString },
+        payload: { params, source: journey.callback.toString() },
       });
     });
 
@@ -258,7 +272,7 @@ export default class JSONReporter extends BaseReporter {
               journey,
               timestamp,
               step,
-              payload: { text, type },
+              payload: { text, type } as Payload,
             });
           });
         }
@@ -276,7 +290,7 @@ export default class JSONReporter extends BaseReporter {
     );
   }
 
-  // Writes a structered synthetics event
+  // Writes a structured synthetics event
   // Note that blob is ultimately stored in ES as a base64 encoded string. You must base 64 encode
   // it before passing it into this function!
   // The payload field is an un-indexed field with no ES mapping, so users can put arbitary structured
@@ -298,11 +312,13 @@ export default class JSONReporter extends BaseReporter {
       journey: {
         name: journey.name,
         id: journey.id,
+        status: type === 'journey/end' ? payload.status : undefined,
       },
       step: step
         ? {
             name: step.name,
             index: step.index,
+            status: type === 'step/end' ? payload.status : undefined,
           }
         : undefined,
       root_fields: { ...(root_fields || {}), ...getMetadata() },


Test patch:
diff --git a/__tests__/reporters/__snapshots__/json.test.ts.snap b/__tests__/reporters/__snapshots__/json.test.ts.snap
index 377be5b..b925586 100644
--- a/__tests__/reporters/__snapshots__/json.test.ts.snap
+++ b/__tests__/reporters/__snapshots__/json.test.ts.snap
@@ -208,11 +208,11 @@ Object {
 
 exports[`json reporter writes each step as NDJSON to the FD 1`] = `
 "{\\"type\\":\\"journey/register\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"package_version\\":\\"0.0.1\\"}
-{\\"type\\":\\"journey/start\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"params\\":{}},\\"package_version\\":\\"0.0.1\\"}
+{\\"type\\":\\"journey/start\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"params\\":{},\\"source\\":\\"async () => { }\\"},\\"package_version\\":\\"0.0.1\\"}
 {\\"type\\":\\"step/screenshot\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"step\\":{\\"name\\":\\"s1\\",\\"index\\":1},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"blob\\":\\"dummy\\",\\"package_version\\":\\"0.0.1\\"}
-{\\"type\\":\\"step/end\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"step\\":{\\"name\\":\\"s1\\",\\"index\\":1},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"source\\":\\"async () => { }\\",\\"start\\":0,\\"end\\":10,\\"url\\":\\"dummy\\",\\"status\\":\\"succeeded\\"},\\"url\\":\\"dummy\\",\\"package_version\\":\\"0.0.1\\"}
+{\\"type\\":\\"step/end\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"step\\":{\\"name\\":\\"s1\\",\\"index\\":1,\\"status\\":\\"succeeded\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"source\\":\\"async () => { }\\",\\"start\\":0,\\"end\\":10,\\"url\\":\\"dummy\\",\\"status\\":\\"succeeded\\"},\\"url\\":\\"dummy\\",\\"package_version\\":\\"0.0.1\\"}
 {\\"type\\":\\"journey/network_info\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"user_agent\\":{},\\"http\\":{\\"request\\":{\\"body\\":{\\"bytes\\":0,\\"content\\":\\"\\"}}},\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"request\\":{},\\"is_navigation_request\\":true,\\"browser\\":{}},\\"package_version\\":\\"0.0.1\\"}
 {\\"type\\":\\"journey/filmstrips\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"index\\":0,\\"startTime\\":392583.998697,\\"ts\\":392583998697},\\"blob\\":\\"dummy\\",\\"package_version\\":\\"0.0.1\\"}
-{\\"type\\":\\"journey/end\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"start\\":0,\\"end\\":11,\\"status\\":\\"succeeded\\"},\\"package_version\\":\\"0.0.1\\"}
+{\\"type\\":\\"journey/end\\",\\"@timestamp\\":1600300800000000,\\"journey\\":{\\"name\\":\\"j1\\",\\"id\\":\\"j1\\",\\"status\\":\\"succeeded\\"},\\"root_fields\\":{\\"os\\":{\\"platform\\":\\"darwin\\"},\\"package\\":{\\"name\\":\\"@elastic/synthetics\\",\\"version\\":\\"0.0.1\\"}},\\"payload\\":{\\"start\\":0,\\"end\\":11,\\"status\\":\\"succeeded\\"},\\"package_version\\":\\"0.0.1\\"}
 "
 `;
diff --git a/__tests__/reporters/json.test.ts b/__tests__/reporters/json.test.ts
index b0dea97..a070bde 100644
--- a/__tests__/reporters/json.test.ts
+++ b/__tests__/reporters/json.test.ts
@@ -60,7 +60,7 @@ describe('json reporter', () => {
 
   const readAndCloseStream = async () => {
     /**
-     * Close the underyling stream writing to FD to read all the contents
+     * Close the underlying stream writing to FD to read all the contents
      */
     stream.end();
     await new Promise(resolve => stream.once('finish', resolve));