@elastic/synthetics 1.17.2 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/cli.js.map +1 -1
  2. package/dist/common_types.d.ts.map +1 -1
  3. package/dist/core/globals.d.ts +1 -0
  4. package/dist/core/globals.d.ts.map +1 -1
  5. package/dist/core/globals.js +12 -1
  6. package/dist/core/globals.js.map +1 -1
  7. package/dist/core/logger.d.ts.map +1 -1
  8. package/dist/core/logger.js +2 -7
  9. package/dist/core/logger.js.map +1 -1
  10. package/dist/core/mfa.d.ts.map +1 -1
  11. package/dist/core/mfa.js +1 -1
  12. package/dist/dsl/monitor.d.ts +4 -0
  13. package/dist/dsl/monitor.d.ts.map +1 -1
  14. package/dist/dsl/monitor.js +6 -0
  15. package/dist/dsl/monitor.js.map +1 -1
  16. package/dist/formatter/javascript.d.ts.map +1 -1
  17. package/dist/formatter/javascript.js.map +1 -1
  18. package/dist/generator/utils.d.ts +1 -1
  19. package/dist/helpers.d.ts.map +1 -1
  20. package/dist/helpers.js.map +1 -1
  21. package/dist/plugins/tracing.js.map +1 -1
  22. package/dist/push/bundler.d.ts +2 -5
  23. package/dist/push/bundler.d.ts.map +1 -1
  24. package/dist/push/bundler.js +15 -30
  25. package/dist/push/bundler.js.map +1 -1
  26. package/dist/push/index.d.ts.map +1 -1
  27. package/dist/push/index.js +21 -6
  28. package/dist/push/index.js.map +1 -1
  29. package/dist/push/monitor.d.ts +4 -1
  30. package/dist/push/monitor.d.ts.map +1 -1
  31. package/dist/push/monitor.js +13 -1
  32. package/dist/push/monitor.js.map +1 -1
  33. package/dist/push/run-local.d.ts +27 -0
  34. package/dist/push/run-local.d.ts.map +1 -0
  35. package/dist/push/run-local.js +132 -0
  36. package/dist/push/run-local.js.map +1 -0
  37. package/dist/push/utils.d.ts +2 -0
  38. package/dist/push/utils.d.ts.map +1 -1
  39. package/dist/push/utils.js +33 -1
  40. package/dist/push/utils.js.map +1 -1
  41. package/dist/reporters/base.d.ts.map +1 -1
  42. package/dist/reporters/base.js.map +1 -1
  43. package/dist/reporters/build_kite_cli.d.ts.map +1 -1
  44. package/dist/reporters/build_kite_cli.js.map +1 -1
  45. package/dist/reporters/json.d.ts +1 -1
  46. package/dist/reporters/json.d.ts.map +1 -1
  47. package/dist/reporters/json.js +6 -2
  48. package/dist/reporters/json.js.map +1 -1
  49. package/dist/reporters/junit.d.ts.map +1 -1
  50. package/dist/reporters/junit.js.map +1 -1
  51. package/package.json +8 -5
  52. package/src/cli.ts +8 -3
  53. package/src/common_types.ts +1 -1
  54. package/src/core/globals.ts +12 -0
  55. package/src/core/logger.ts +2 -8
  56. package/src/core/mfa.ts +11 -11
  57. package/src/dsl/monitor.ts +7 -0
  58. package/src/formatter/javascript.ts +3 -1
  59. package/src/helpers.ts +3 -3
  60. package/src/loader.ts +1 -1
  61. package/src/plugins/tracing.ts +1 -1
  62. package/src/push/bundler.ts +16 -36
  63. package/src/push/index.ts +28 -10
  64. package/src/push/monitor.ts +16 -4
  65. package/src/push/run-local.ts +155 -0
  66. package/src/push/utils.ts +51 -5
  67. package/src/reporters/base.ts +8 -4
  68. package/src/reporters/build_kite_cli.ts +7 -6
  69. package/src/reporters/json.ts +10 -14
  70. package/src/reporters/junit.ts +4 -10
@@ -29,7 +29,11 @@ import { renderError, serializeError } from './reporter-util';
29
29
  import { symbols, indent, now } from '../helpers';
30
30
  import { Reporter, ReporterOptions } from '.';
31
31
  import { Journey, Step } from '../dsl';
32
- import { JourneyEndResult, JourneyStartResult, StepResult } from '../common_types';
32
+ import {
33
+ JourneyEndResult,
34
+ JourneyStartResult,
35
+ StepResult,
36
+ } from '../common_types';
33
37
 
34
38
  export function renderDuration(durationMs) {
35
39
  return parseInt(durationMs);
@@ -62,11 +66,11 @@ export default class BaseReporter implements Reporter {
62
66
  this.metrics.registered++;
63
67
  }
64
68
 
65
- onJourneyStart(journey: Journey, { }: JourneyStartResult) {
69
+ onJourneyStart(journey: Journey, {}: JourneyStartResult) {
66
70
  this.write(`\nJourney: ${journey.name}`);
67
71
  }
68
72
 
69
- onStepEnd(_: Journey, step: Step, { }: StepResult) {
73
+ onStepEnd(_: Journey, step: Step, {}: StepResult) {
70
74
  const { status, error } = step;
71
75
  const message = `${symbols[status]} Step: '${step.name}' ${status} ${gray(
72
76
  '(' + renderDuration(step.duration * 1000) + ' ms)'
@@ -80,7 +84,7 @@ export default class BaseReporter implements Reporter {
80
84
  }
81
85
 
82
86
  /* eslint-disable @typescript-eslint/no-unused-vars */
83
- onJourneyEnd(journey: Journey, { }: JourneyEndResult) {
87
+ onJourneyEnd(journey: Journey, {}: JourneyEndResult) {
84
88
  const { failed, succeeded, skipped } = this.metrics;
85
89
  const total = failed + succeeded + skipped;
86
90
  /**
@@ -43,7 +43,7 @@ export default class BuildKiteCLIReporter extends BaseReporter {
43
43
  super(options);
44
44
  }
45
45
 
46
- override onJourneyStart(journey: Journey, { }: JourneyStartResult) {
46
+ override onJourneyStart(journey: Journey, {}: JourneyStartResult) {
47
47
  this.write(`\n--- Journey: ${journey.name}`);
48
48
  }
49
49
 
@@ -57,7 +57,9 @@ export default class BuildKiteCLIReporter extends BaseReporter {
57
57
 
58
58
  override async onJourneyEnd(journey: Journey, result: JourneyEndResult) {
59
59
  super.onJourneyEnd(journey, result);
60
- const message = `${symbols[journey.status]} Took (${renderDuration(journey.duration)} seconds)`;
60
+ const message = `${symbols[journey.status]} Took (${renderDuration(
61
+ journey.duration
62
+ )} seconds)`;
61
63
  this.write(message);
62
64
  }
63
65
 
@@ -76,10 +78,9 @@ export default class BuildKiteCLIReporter extends BaseReporter {
76
78
  const name = red(`Journey: ${journeyName} :slightly_frowning_face:`);
77
79
  this.write(`\n+++ ${name}`);
78
80
  steps.forEach(step => {
79
- const message = `${symbols[step.status]
80
- } Step: '${step.name}' ${step.status} (${renderDuration(
81
- step.duration * 1000
82
- )} ms)`;
81
+ const message = `${symbols[step.status]} Step: '${step.name}' ${
82
+ step.status
83
+ } (${renderDuration(step.duration * 1000)} ms)`;
83
84
  this.write(indent(message));
84
85
  if (step.error) {
85
86
  this.write(renderError(serializeError(step.error)));
@@ -253,14 +253,15 @@ function formatJSONError(error: Error | any) {
253
253
  };
254
254
  }
255
255
 
256
- function journeyInfo(
257
- journey: Partial<Journey>,
258
- type: OutputFields['type'],
259
- ) {
256
+ function journeyInfo(journey: Partial<Journey>, type: OutputFields['type']) {
260
257
  if (!journey) {
261
258
  return;
262
259
  }
263
- const info: JourneyInfo = { name: journey.name, id: journey.id, tags: journey.tags };
260
+ const info: JourneyInfo = {
261
+ name: journey.name,
262
+ id: journey.id,
263
+ tags: journey.tags,
264
+ };
264
265
  const isEnd = type === 'journey/end';
265
266
  if (isEnd) {
266
267
  info.status = journey.status;
@@ -271,7 +272,7 @@ function journeyInfo(
271
272
 
272
273
  function stepInfo(
273
274
  step: Partial<Step>,
274
- type: OutputFields['type'],
275
+ type: OutputFields['type']
275
276
  ): Omit<Partial<Step>, 'duration'> & Duration {
276
277
  if (!step) {
277
278
  return;
@@ -375,8 +376,8 @@ export default class JSONReporter extends BaseReporter {
375
376
  },
376
377
  payload: event.networkConditions
377
378
  ? {
378
- network_conditions: event.networkConditions,
379
- }
379
+ network_conditions: event.networkConditions,
380
+ }
380
381
  : undefined,
381
382
  });
382
383
  }
@@ -400,12 +401,7 @@ export default class JSONReporter extends BaseReporter {
400
401
  override onStepEnd(
401
402
  journey: Journey,
402
403
  step: Step,
403
- {
404
- pagemetrics,
405
- traces,
406
- metrics,
407
- filmstrips,
408
- }: StepEndResult
404
+ { pagemetrics, traces, metrics, filmstrips }: StepEndResult
409
405
  ) {
410
406
  this.writeMetrics(journey, step, 'relative_trace', traces);
411
407
  this.writeMetrics(journey, step, 'experience', metrics);
@@ -25,10 +25,7 @@
25
25
 
26
26
  import { mkdir, writeFile } from 'fs/promises';
27
27
  import { dirname } from 'path';
28
- import {
29
- JourneyEndResult,
30
- JourneyStartResult,
31
- } from '../common_types';
28
+ import { JourneyEndResult, JourneyStartResult } from '../common_types';
32
29
  import { Journey, Step } from '../dsl';
33
30
  import { indent, now } from '../helpers';
34
31
  import BaseReporter from './base';
@@ -59,7 +56,7 @@ export default class JUnitReporter extends BaseReporter {
59
56
  private totalSkipped = 0;
60
57
  #journeyMap = new Map<string, XMLEntry>();
61
58
 
62
- override onJourneyStart(journey: Journey, { }: JourneyStartResult) {
59
+ override onJourneyStart(journey: Journey, {}: JourneyStartResult) {
63
60
  if (!this.#journeyMap.has(journey.name)) {
64
61
  const entry = {
65
62
  name: 'testsuite',
@@ -76,10 +73,7 @@ export default class JUnitReporter extends BaseReporter {
76
73
  }
77
74
  }
78
75
 
79
- override onStepEnd(
80
- journey: Journey,
81
- step: Step,
82
- ) {
76
+ override onStepEnd(journey: Journey, step: Step) {
83
77
  if (!this.#journeyMap.has(journey.name)) {
84
78
  return;
85
79
  }
@@ -117,7 +111,7 @@ export default class JUnitReporter extends BaseReporter {
117
111
  entry.children.push(caseEntry);
118
112
  }
119
113
 
120
- override onJourneyEnd(journey: Journey, { }: JourneyEndResult) {
114
+ override onJourneyEnd(journey: Journey, {}: JourneyEndResult) {
121
115
  if (!this.#journeyMap.has(journey.name)) {
122
116
  return;
123
117
  }