@datadog/datadog-ci-plugin-synthetics 5.13.1 → 5.14.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.
package/README.md CHANGED
@@ -390,6 +390,17 @@ The filename for a JUnit report if you want to generate one.
390
390
  * ENV variable: `DATADOG_SYNTHETICS_JUNIT_REPORT="e2e-test-junit.xml"`
391
391
  * CLI param:`-j "e2e-test-junit.xml"` / `--jUnitReport "e2e-test-junit.xml"`
392
392
 
393
+ #### `jsonReport`
394
+
395
+ The filename for a JSON report of your test results if you want to generate one. The shape of the results is [`synthetics.Result[]`][19].
396
+
397
+ **Configuration options**
398
+
399
+ * Default: None
400
+ * Global Config: `"jsonReport": "test-results-report.json"`
401
+ * ENV variable: `DATADOG_SYNTHETICS_JSON_REPORT="test-results-report.json"`
402
+ * CLI param: `--jsonReport "test-results-report.json"`
403
+
393
404
  #### `mobileApplicationVersionFilePath`
394
405
 
395
406
  Override the mobile application version for [Synthetic mobile application tests][18] with a local or recently built application.
@@ -1031,6 +1042,7 @@ Two reporters are supported out-of-the-box:
1031
1042
 
1032
1043
  1. `stdout`
1033
1044
  2. JUnit
1045
+ 3. JSON
1034
1046
 
1035
1047
  To enable the JUnit report, specify a filename for your JUnit report with `-j/--jUnitReport`.
1036
1048
 
@@ -1038,6 +1050,12 @@ To enable the JUnit report, specify a filename for your JUnit report with `-j/--
1038
1050
  yarn datadog-ci synthetics run-tests -s 'tag:e2e-tests' --config global-config.json --jUnitReport junit-report.xml
1039
1051
  ```
1040
1052
 
1053
+ To enable the JSON report, specify a filename for your JSON report with `--jsonReport`.
1054
+
1055
+ ```bash
1056
+ yarn datadog-ci synthetics run-tests -s 'tag:e2e-tests' --config global-config.json --jsonReport test-results-report.json
1057
+ ```
1058
+
1041
1059
  Reporters can hook themselves into the `MainReporter` of the command.
1042
1060
 
1043
1061
  ### Available hooks
@@ -1113,6 +1131,7 @@ Additional helpful documentation, links, and articles:
1113
1131
  [16]: https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site
1114
1132
  [17]: https://app.datadoghq.com/synthetics/settings/continuous-testing
1115
1133
  [18]: https://docs.datadoghq.com/synthetics/mobile_app_testing/
1134
+ [19]: https://github.com/DataDog/datadog-ci/blob/master/packages/plugin-synthetics/src/interfaces.ts#L223-L254
1116
1135
 
1117
1136
  <!--
1118
1137
  This page is single-sourced:
package/dist/bundle.d.ts CHANGED
@@ -1284,7 +1284,7 @@ interface ProxyConfiguration {
1284
1284
  }
1285
1285
  //#endregion
1286
1286
  //#region src/interfaces.d.ts
1287
- type SupportedReporter = 'junit' | 'default';
1287
+ type SupportedReporter = 'junit' | 'json' | 'default';
1288
1288
  interface MainReporter {
1289
1289
  log(log: string): void;
1290
1290
  error(error: string): void;
@@ -1939,6 +1939,7 @@ interface RunTestsCommandConfig extends SyntheticsCIConfig {
1939
1939
  failOnTimeout: boolean;
1940
1940
  files: string[];
1941
1941
  jUnitReport?: string;
1942
+ jsonReport?: string;
1942
1943
  mobileApplicationVersionFilePath?: string;
1943
1944
  publicIds: string[];
1944
1945
  /** Whether to only run the tests which failed in the previous test batches. By default, the organization default setting is used. */
@@ -2060,6 +2061,41 @@ declare class DefaultReporter implements MainReporter {
2060
2061
  private removeSpinner;
2061
2062
  }
2062
2063
  //#endregion
2064
+ //#region src/reporters/file.d.ts
2065
+ type Args$2 = {
2066
+ context: ReporterContext;
2067
+ defaultExtension: string;
2068
+ destination: string;
2069
+ reportName: string;
2070
+ };
2071
+ declare abstract class FileReporter {
2072
+ protected destination: string;
2073
+ protected write: Writable['write'];
2074
+ private reportName;
2075
+ constructor({
2076
+ context,
2077
+ defaultExtension,
2078
+ destination,
2079
+ reportName
2080
+ }: Args$2);
2081
+ protected writeReportToFile(contents: string): void;
2082
+ }
2083
+ //#endregion
2084
+ //#region src/reporters/json.d.ts
2085
+ interface Args$1 {
2086
+ context: ReporterContext;
2087
+ jsonReport?: string;
2088
+ }
2089
+ declare class JSONReporter extends FileReporter implements Reporter {
2090
+ private readonly results;
2091
+ constructor({
2092
+ context,
2093
+ jsonReport
2094
+ }: Args$1);
2095
+ resultEnd(result: Result): void;
2096
+ runEnd(): void;
2097
+ }
2098
+ //#endregion
2063
2099
  //#region src/reporters/junit.d.ts
2064
2100
  interface SuiteStats {
2065
2101
  errors: number;
@@ -2136,11 +2172,9 @@ interface Args {
2136
2172
  jUnitReport?: string;
2137
2173
  runName?: string;
2138
2174
  }
2139
- declare class JUnitReporter implements Reporter {
2175
+ declare class JUnitReporter extends FileReporter implements Reporter {
2140
2176
  private builder;
2141
- private destination;
2142
2177
  private json;
2143
- private write;
2144
2178
  constructor({
2145
2179
  context,
2146
2180
  jUnitReport,
@@ -2165,6 +2199,7 @@ declare class JUnitReporter implements Reporter {
2165
2199
  type ExecuteOptions = {
2166
2200
  initialSummary?: InitialSummary;
2167
2201
  jUnitReport?: string;
2202
+ jsonReport?: string;
2168
2203
  reporters?: (SupportedReporter | Reporter)[];
2169
2204
  runId?: string;
2170
2205
  suites?: Suite[];
@@ -2178,14 +2213,7 @@ declare const planDryRun: (reporter: MainReporter, runConfig: WrapperConfig, sui
2178
2213
  testPlan: TestPlan;
2179
2214
  initialSummary: InitialSummary;
2180
2215
  }>;
2181
- declare const executeWithDetails: (runConfig: WrapperConfig, {
2182
- initialSummary,
2183
- jUnitReport,
2184
- reporters,
2185
- runId,
2186
- suites,
2187
- testPlan
2188
- }: ExecuteOptions) => Promise<{
2216
+ declare const executeWithDetails: (runConfig: WrapperConfig, executeOptions: ExecuteOptions) => Promise<{
2189
2217
  results: Result[];
2190
2218
  summary: Summary;
2191
2219
  exitCode: 0 | 1;
@@ -2296,6 +2324,7 @@ declare class SyntheticsRunTestsCommand extends BaseCommand {
2296
2324
  static paths: string[][];
2297
2325
  static usage: Usage;
2298
2326
  jUnitReport: string | undefined;
2327
+ jsonReport: string | undefined;
2299
2328
  runName: string | undefined;
2300
2329
  protected apiKey: string | undefined;
2301
2330
  protected appKey: string | undefined;
@@ -2388,5 +2417,5 @@ declare const commands: {
2388
2417
  };
2389
2418
  };
2390
2419
  //#endregion
2391
- export { APIConfiguration, APIHelperConfig, ApiServerResult, AppUploadDetails, Assertion, BaseConfigOverride, BaseResult, BaseResultInBatch, BaseServerResult, BasicAuthCredentials, Batch, BatchOptions, BrowserError, BrowserServerResult, CiError, CookiesObject, CriticalError, DEFAULT_COMMAND_CONFIG, DatadogCIConfig, DefaultReporter, DeployTestsCommandConfig, Device, ExecutionRule, ImportTestsCommandConfig, JUnitReporter, LocalTestDefinition, LocalTestPayload, LocalTriggerConfig, Location, LocationsMapping, MainReporter, MobileAppExtractedMetadata, MobileAppUploadResult, MobileApplication, MobileApplicationNewVersionParams, MobileApplicationUploadPart, MobileApplicationUploadPartResponse, MobileApplicationVersion, MobileTestWithOverride, MultiLocator, MultiStep, MultiStepsServerResult, MultipartPresignedUrlsResponse, Operator, OptionsWithUnsupportedFields, Payload, PollResult, RawPollResult, RawPollResultTest, RemoteTestPayload, RemoteTriggerConfig, Reporter, ReporterContext, Result, ResultDisplayInfo, ResultInBatch, ResultInBatchSkippedBySelectiveRerun, ResultSkippedBySelectiveRerun, RetryConfig, RunTestsCommandConfig, SelectiveRerunDecision, ServerBatch, ServerConfigOverride, ServerResult, ServerTest, ServerTrigger, Step, Suite, Summary, SupportedReporter, SyntheticsCIConfig, SyntheticsOrgSettings, Test, TestConfig, TestMissing, TestPayload, TestPlan, TestPlanItem, TestRequest, TestSearchResult, TestSkipped, TestStepWithUnsupportedFields, TestWithOverride, TriggerConfig, TriggerInfo, UploadApplicationCommandConfig, UserConfigOverride, Vitals, WrapperConfig, type XMLJSON, commands, execute, executeTests, executeWithDetails, planDryRun, public_d_exports as utils };
2420
+ export { APIConfiguration, APIHelperConfig, ApiServerResult, AppUploadDetails, Assertion, BaseConfigOverride, BaseResult, BaseResultInBatch, BaseServerResult, BasicAuthCredentials, Batch, BatchOptions, BrowserError, BrowserServerResult, CiError, CookiesObject, CriticalError, DEFAULT_COMMAND_CONFIG, DatadogCIConfig, DefaultReporter, DeployTestsCommandConfig, Device, ExecutionRule, ImportTestsCommandConfig, JSONReporter, JUnitReporter, LocalTestDefinition, LocalTestPayload, LocalTriggerConfig, Location, LocationsMapping, MainReporter, MobileAppExtractedMetadata, MobileAppUploadResult, MobileApplication, MobileApplicationNewVersionParams, MobileApplicationUploadPart, MobileApplicationUploadPartResponse, MobileApplicationVersion, MobileTestWithOverride, MultiLocator, MultiStep, MultiStepsServerResult, MultipartPresignedUrlsResponse, Operator, OptionsWithUnsupportedFields, Payload, PollResult, RawPollResult, RawPollResultTest, RemoteTestPayload, RemoteTriggerConfig, Reporter, ReporterContext, Result, ResultDisplayInfo, ResultInBatch, ResultInBatchSkippedBySelectiveRerun, ResultSkippedBySelectiveRerun, RetryConfig, RunTestsCommandConfig, SelectiveRerunDecision, ServerBatch, ServerConfigOverride, ServerResult, ServerTest, ServerTrigger, Step, Suite, Summary, SupportedReporter, SyntheticsCIConfig, SyntheticsOrgSettings, Test, TestConfig, TestMissing, TestPayload, TestPlan, TestPlanItem, TestRequest, TestSearchResult, TestSkipped, TestStepWithUnsupportedFields, TestWithOverride, TriggerConfig, TriggerInfo, UploadApplicationCommandConfig, UserConfigOverride, Vitals, WrapperConfig, type XMLJSON, commands, execute, executeTests, executeWithDetails, planDryRun, public_d_exports as utils };
2392
2421
  //# sourceMappingURL=bundle.d.ts.map