@datadog/datadog-ci 1.6.0 → 1.7.2
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 +4 -0
- package/dist/commands/lambda/__tests__/functions/commons.test.js +8 -0
- package/dist/commands/lambda/__tests__/functions/commons.test.js.map +1 -1
- package/dist/commands/lambda/__tests__/instrument.test.js +22 -0
- package/dist/commands/lambda/__tests__/instrument.test.js.map +1 -1
- package/dist/commands/lambda/constants.d.ts +2 -0
- package/dist/commands/lambda/constants.js +2 -0
- package/dist/commands/lambda/constants.js.map +1 -1
- package/dist/commands/lambda/functions/commons.d.ts +2 -2
- package/dist/commands/synthetics/__tests__/api.test.js +1 -4
- package/dist/commands/synthetics/__tests__/api.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/cli.test.js +161 -24
- package/dist/commands/synthetics/__tests__/cli.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/fixtures.d.ts +40 -45
- package/dist/commands/synthetics/__tests__/fixtures.js +86 -39
- package/dist/commands/synthetics/__tests__/fixtures.js.map +1 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.js +159 -2
- package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js +16 -15
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/run-test.test.js +37 -22
- package/dist/commands/synthetics/__tests__/run-test.test.js.map +1 -1
- package/dist/commands/synthetics/__tests__/utils.test.js +139 -118
- package/dist/commands/synthetics/__tests__/utils.test.js.map +1 -1
- package/dist/commands/synthetics/api.d.ts +13 -2
- package/dist/commands/synthetics/api.js.map +1 -1
- package/dist/commands/synthetics/command.d.ts +7 -1
- package/dist/commands/synthetics/command.js +41 -51
- package/dist/commands/synthetics/command.js.map +1 -1
- package/dist/commands/synthetics/errors.d.ts +2 -2
- package/dist/commands/synthetics/errors.js +4 -4
- package/dist/commands/synthetics/errors.js.map +1 -1
- package/dist/commands/synthetics/interfaces.d.ts +29 -28
- package/dist/commands/synthetics/interfaces.js.map +1 -1
- package/dist/commands/synthetics/reporters/default.d.ts +4 -4
- package/dist/commands/synthetics/reporters/default.js +67 -71
- package/dist/commands/synthetics/reporters/default.js.map +1 -1
- package/dist/commands/synthetics/reporters/junit.d.ts +2 -3
- package/dist/commands/synthetics/reporters/junit.js +47 -53
- package/dist/commands/synthetics/reporters/junit.js.map +1 -1
- package/dist/commands/synthetics/run-test.d.ts +15 -8
- package/dist/commands/synthetics/run-test.js +19 -12
- package/dist/commands/synthetics/run-test.js.map +1 -1
- package/dist/commands/synthetics/utils.d.ts +18 -13
- package/dist/commands/synthetics/utils.js +86 -50
- package/dist/commands/synthetics/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -59,11 +59,9 @@ class RunTestCommand extends clipanion_1.Command {
|
|
|
59
59
|
}
|
|
60
60
|
let results;
|
|
61
61
|
let summary;
|
|
62
|
-
let tests;
|
|
63
|
-
let triggers;
|
|
64
62
|
try {
|
|
65
63
|
;
|
|
66
|
-
({ results, summary
|
|
64
|
+
({ results, summary } = yield run_test_1.executeTests(this.reporter, this.config));
|
|
67
65
|
}
|
|
68
66
|
catch (error) {
|
|
69
67
|
if (error instanceof errors_1.CiError) {
|
|
@@ -80,56 +78,49 @@ class RunTestCommand extends clipanion_1.Command {
|
|
|
80
78
|
}
|
|
81
79
|
return 0;
|
|
82
80
|
}
|
|
83
|
-
return this.renderResults(results, summary,
|
|
81
|
+
return this.renderResults(results, summary, startTime);
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
84
|
getAppBaseURL() {
|
|
87
85
|
return `https://${this.config.subdomain}.${this.config.datadogSite}/`;
|
|
88
86
|
}
|
|
89
|
-
renderResults(results, summary,
|
|
90
|
-
var _a, _b, _c
|
|
91
|
-
// Sort tests to show success first then non blocking failures and finally blocking failures.
|
|
92
|
-
tests.sort(this.sortTestsByOutcome(results));
|
|
87
|
+
renderResults(results, summary, startTime) {
|
|
88
|
+
var _a, _b, _c;
|
|
93
89
|
// Rendering the results.
|
|
94
90
|
(_a = this.reporter) === null || _a === void 0 ? void 0 : _a.reportStart({ startTime });
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
if (!this.config.failOnTimeout) {
|
|
92
|
+
if (!summary.timedOut) {
|
|
93
|
+
summary.timedOut = 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!this.config.failOnCriticalErrors) {
|
|
97
|
+
if (!summary.criticalErrors) {
|
|
98
|
+
summary.criticalErrors = 0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
99
101
|
let hasSucceeded = true; // Determine if all the tests have succeeded
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!this.config.failOnTimeout) {
|
|
103
|
-
|
|
104
|
-
summary.timedOut = 0;
|
|
105
|
-
}
|
|
106
|
-
const hasTimeout = testResults.some((pollResult) => pollResult.result.error === interfaces_1.ERRORS.TIMEOUT);
|
|
107
|
-
if (hasTimeout) {
|
|
108
|
-
summary.timedOut++;
|
|
109
|
-
}
|
|
102
|
+
const sortedResults = results.sort(this.sortResultsByOutcome());
|
|
103
|
+
for (const result of sortedResults) {
|
|
104
|
+
if (!this.config.failOnTimeout && result.result.error === interfaces_1.ERRORS.TIMEOUT) {
|
|
105
|
+
summary.timedOut++;
|
|
110
106
|
}
|
|
111
|
-
if (!this.config.failOnCriticalErrors) {
|
|
112
|
-
|
|
113
|
-
summary.criticalErrors = 0;
|
|
114
|
-
}
|
|
115
|
-
const hasCriticalErrors = testResults.some((pollResult) => utils_2.isCriticalError(pollResult.result));
|
|
116
|
-
if (hasCriticalErrors) {
|
|
117
|
-
summary.criticalErrors++;
|
|
118
|
-
}
|
|
107
|
+
if (!this.config.failOnCriticalErrors && utils_2.isCriticalError(result.result)) {
|
|
108
|
+
summary.criticalErrors++;
|
|
119
109
|
}
|
|
120
|
-
const
|
|
121
|
-
if (passed) {
|
|
110
|
+
const resultOutcome = utils_2.getResultOutcome(result);
|
|
111
|
+
if (["passed" /* Passed */, "passed-non-blocking" /* PassedNonBlocking */].includes(resultOutcome)) {
|
|
122
112
|
summary.passed++;
|
|
123
113
|
}
|
|
114
|
+
else if (resultOutcome === "failed-non-blocking" /* FailedNonBlocking */) {
|
|
115
|
+
summary.failedNonBlocking++;
|
|
116
|
+
}
|
|
124
117
|
else {
|
|
125
118
|
summary.failed++;
|
|
126
|
-
|
|
127
|
-
hasSucceeded = false;
|
|
128
|
-
}
|
|
119
|
+
hasSucceeded = false;
|
|
129
120
|
}
|
|
130
|
-
(
|
|
121
|
+
(_b = this.reporter) === null || _b === void 0 ? void 0 : _b.resultEnd(result, this.getAppBaseURL());
|
|
131
122
|
}
|
|
132
|
-
(
|
|
123
|
+
(_c = this.reporter) === null || _c === void 0 ? void 0 : _c.runEnd(summary);
|
|
133
124
|
return hasSucceeded ? 0 : 1;
|
|
134
125
|
}
|
|
135
126
|
reportCiError(error, reporter) {
|
|
@@ -213,21 +204,20 @@ class RunTestCommand extends clipanion_1.Command {
|
|
|
213
204
|
}
|
|
214
205
|
});
|
|
215
206
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
return success1 ? -1 : 1;
|
|
207
|
+
/**
|
|
208
|
+
* Sort results with the following rules:
|
|
209
|
+
* - Passed results come first
|
|
210
|
+
* - Then non-blocking failed results
|
|
211
|
+
* - And finally failed results
|
|
212
|
+
*/
|
|
213
|
+
sortResultsByOutcome() {
|
|
214
|
+
const outcomeWeight = {
|
|
215
|
+
["passed-non-blocking" /* PassedNonBlocking */]: 1,
|
|
216
|
+
["passed" /* Passed */]: 2,
|
|
217
|
+
["failed-non-blocking" /* FailedNonBlocking */]: 3,
|
|
218
|
+
["failed" /* Failed */]: 4,
|
|
230
219
|
};
|
|
220
|
+
return (r1, r2) => outcomeWeight[utils_2.getResultOutcome(r1)] - outcomeWeight[utils_2.getResultOutcome(r2)];
|
|
231
221
|
}
|
|
232
222
|
}
|
|
233
223
|
exports.RunTestCommand = RunTestCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/commands/synthetics/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,yCAAiC;AACjC,8DAAoC;AAEpC,+CAA0E;AAC1E,qCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/commands/synthetics/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,yCAAiC;AACjC,8DAAoC;AAEpC,+CAA0E;AAC1E,qCAA+C;AAC/C,6CAA2F;AAC3F,iDAAmD;AACnD,6CAA+C;AAC/C,yCAAuC;AACvC,mCAA4G;AAE/F,QAAA,sBAAsB,GAAkB;IACnD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,iBAAiB;IAC7B,WAAW,EAAE,eAAe;IAC5B,oBAAoB,EAAE,KAAK;IAC3B,aAAa,EAAE,IAAI;IACnB,KAAK,EAAE,CAAC,yCAAyC,CAAC;IAClD,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAC7B,KAAK,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC;IACzB,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,eAAe,EAAE,EAAE;CACpB,CAAA;AAED,MAAa,cAAe,SAAQ,mBAAO;IAA3C;;QAKU,WAAM,GAAkB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,8BAAsB,CAAC,CAAC,CAA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AE,mBAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAC3E,cAAc,CAAC,SAAS,CAAC,WAAW,EAAE,mBAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;AACtE,cAAc,CAAC,SAAS,CAAC,SAAS,EAAE,mBAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;AACnE,cAAc,CAAC,SAAS,CAAC,WAAW,EAAE,mBAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;AACrE,cAAc,CAAC,SAAS,CAAC,iBAAiB,EAAE,mBAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;AAC1E,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;AAClE,cAAc,CAAC,SAAS,CAAC,iBAAiB,EAAE,mBAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA"}
|
|
@@ -5,10 +5,10 @@ export declare type CriticalCiErrorCode = typeof criticalErrorCodes[number];
|
|
|
5
5
|
export declare type CiErrorCode = NonCriticalCiErrorCode | CriticalCiErrorCode;
|
|
6
6
|
export declare class CiError extends Error {
|
|
7
7
|
code: CiErrorCode;
|
|
8
|
-
constructor(code: CiErrorCode);
|
|
8
|
+
constructor(code: CiErrorCode, message?: string);
|
|
9
9
|
}
|
|
10
10
|
export declare class CriticalError extends CiError {
|
|
11
11
|
code: CriticalCiErrorCode;
|
|
12
|
-
constructor(code: CriticalCiErrorCode);
|
|
12
|
+
constructor(code: CriticalCiErrorCode, message?: string);
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -14,15 +14,15 @@ const criticalErrorCodes = [
|
|
|
14
14
|
'UNAVAILABLE_TUNNEL_CONFIG',
|
|
15
15
|
];
|
|
16
16
|
class CiError extends Error {
|
|
17
|
-
constructor(code) {
|
|
18
|
-
super();
|
|
17
|
+
constructor(code, message) {
|
|
18
|
+
super(message);
|
|
19
19
|
this.code = code;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.CiError = CiError;
|
|
23
23
|
class CriticalError extends CiError {
|
|
24
|
-
constructor(code) {
|
|
25
|
-
super(code);
|
|
24
|
+
constructor(code, message) {
|
|
25
|
+
super(code, message);
|
|
26
26
|
this.code = code;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/commands/synthetics/errors.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,MAAM,qBAAqB,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAU,CAAA;AAGhF,MAAM,kBAAkB,GAAG;IACzB,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,yBAAyB;IACzB,2BAA2B;CACnB,CAAA;AAKV,MAAa,OAAQ,SAAQ,KAAK;IAChC,YAAmB,IAAiB;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/commands/synthetics/errors.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,MAAM,qBAAqB,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAU,CAAA;AAGhF,MAAM,kBAAkB,GAAG;IACzB,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,yBAAyB;IACzB,2BAA2B;CACnB,CAAA;AAKV,MAAa,OAAQ,SAAQ,KAAK;IAChC,YAAmB,IAAiB,EAAE,OAAgB;QACpD,KAAK,CAAC,OAAO,CAAC,CAAA;QADG,SAAI,GAAJ,IAAI,CAAa;IAEpC,CAAC;CACF;AAJD,0BAIC;AAED,MAAa,aAAc,SAAQ,OAAO;IACxC,YAAmB,IAAyB,EAAE,OAAgB;QAC5D,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QADH,SAAI,GAAJ,IAAI,CAAqB;IAE5C,CAAC;CACF;AAJD,sCAIC"}
|
|
@@ -9,9 +9,9 @@ export interface MainReporter {
|
|
|
9
9
|
reportStart(timings: {
|
|
10
10
|
startTime: number;
|
|
11
11
|
}): void;
|
|
12
|
+
resultEnd(result: Result, baseUrl: string): void;
|
|
13
|
+
resultReceived(result: Result): void;
|
|
12
14
|
runEnd(summary: Summary): void;
|
|
13
|
-
testEnd(test: Test, results: PollResult[], baseUrl: string, locationNames: LocationsMapping, failOnCriticalErrors: boolean, failOnTimeout: boolean): void;
|
|
14
|
-
testResult(triggerResponse: TriggerResponse, result: PollResult): void;
|
|
15
15
|
testsWait(tests: Test[]): void;
|
|
16
16
|
testTrigger(test: Test, testId: string, executionRule: ExecutionRule, config: ConfigOverride): void;
|
|
17
17
|
testWait(test: Test): void;
|
|
@@ -22,7 +22,7 @@ export declare enum ERRORS {
|
|
|
22
22
|
TUNNEL = "Tunnel Failure"
|
|
23
23
|
}
|
|
24
24
|
export declare type Reporter = Partial<MainReporter>;
|
|
25
|
-
export interface
|
|
25
|
+
export interface BaseServerResult {
|
|
26
26
|
error?: string;
|
|
27
27
|
errorCode?: string;
|
|
28
28
|
errorMessage?: string;
|
|
@@ -32,10 +32,9 @@ export interface TestResult {
|
|
|
32
32
|
message: string;
|
|
33
33
|
};
|
|
34
34
|
passed: boolean;
|
|
35
|
-
tunnel?: boolean;
|
|
36
35
|
unhealthy?: boolean;
|
|
37
36
|
}
|
|
38
|
-
export interface
|
|
37
|
+
export interface BrowserServerResult extends BaseServerResult {
|
|
39
38
|
device: {
|
|
40
39
|
height: number;
|
|
41
40
|
id: string;
|
|
@@ -51,7 +50,7 @@ interface AssertionResult {
|
|
|
51
50
|
expected?: any;
|
|
52
51
|
valid: boolean;
|
|
53
52
|
}
|
|
54
|
-
export interface
|
|
53
|
+
export interface ApiServerResult extends BaseServerResult {
|
|
55
54
|
assertionResults: AssertionResult[];
|
|
56
55
|
timings: {
|
|
57
56
|
total: number;
|
|
@@ -72,19 +71,33 @@ export interface MultiStep {
|
|
|
72
71
|
total: number;
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
|
-
export interface
|
|
74
|
+
export interface MultiStepsServerResult extends BaseServerResult {
|
|
76
75
|
duration: number;
|
|
77
76
|
steps: MultiStep[];
|
|
78
77
|
}
|
|
79
|
-
export declare type
|
|
78
|
+
export declare type ServerResult = BrowserServerResult | ApiServerResult | MultiStepsServerResult;
|
|
79
|
+
interface Enrichment {
|
|
80
|
+
batch_id: string;
|
|
81
|
+
config_override: ConfigOverride & {
|
|
82
|
+
executionRule: ExecutionRule;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
80
85
|
export interface PollResult {
|
|
81
|
-
check
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
result: Result;
|
|
86
|
+
check: Pick<Test, 'config' | 'subtype' | 'type'>;
|
|
87
|
+
enrichment?: Partial<Enrichment>;
|
|
88
|
+
result: ServerResult;
|
|
85
89
|
resultID: string;
|
|
86
90
|
timestamp: number;
|
|
87
91
|
}
|
|
92
|
+
export interface Result {
|
|
93
|
+
enrichment?: Partial<Enrichment>;
|
|
94
|
+
location: string;
|
|
95
|
+
passed: boolean;
|
|
96
|
+
result: ServerResult;
|
|
97
|
+
resultId: string;
|
|
98
|
+
test: Test;
|
|
99
|
+
timestamp: number;
|
|
100
|
+
}
|
|
88
101
|
export interface Vitals {
|
|
89
102
|
cls?: number;
|
|
90
103
|
lcp?: number;
|
|
@@ -115,7 +128,7 @@ export interface Step {
|
|
|
115
128
|
type: string;
|
|
116
129
|
}[];
|
|
117
130
|
}
|
|
118
|
-
export interface
|
|
131
|
+
export interface ServerTest {
|
|
119
132
|
config: {
|
|
120
133
|
assertions: Assertion[];
|
|
121
134
|
request: {
|
|
@@ -146,7 +159,7 @@ export interface Test {
|
|
|
146
159
|
ci?: {
|
|
147
160
|
executionRule: ExecutionRule;
|
|
148
161
|
};
|
|
149
|
-
device_ids
|
|
162
|
+
device_ids?: string[];
|
|
150
163
|
min_failure_duration: number;
|
|
151
164
|
min_location_failed: number;
|
|
152
165
|
tick_every: number;
|
|
@@ -160,7 +173,7 @@ export interface Test {
|
|
|
160
173
|
tags: string[];
|
|
161
174
|
type: string;
|
|
162
175
|
}
|
|
163
|
-
export interface
|
|
176
|
+
export interface Test extends ServerTest {
|
|
164
177
|
suite?: string;
|
|
165
178
|
}
|
|
166
179
|
export interface Assertion {
|
|
@@ -206,7 +219,6 @@ export interface TriggerResponse {
|
|
|
206
219
|
}
|
|
207
220
|
export interface TriggerResult extends TriggerResponse {
|
|
208
221
|
pollingTimeout: number;
|
|
209
|
-
result?: PollResult;
|
|
210
222
|
}
|
|
211
223
|
export interface Location {
|
|
212
224
|
display_name: string;
|
|
@@ -221,7 +233,6 @@ export interface LocationsMapping {
|
|
|
221
233
|
export interface Trigger {
|
|
222
234
|
locations: Location[];
|
|
223
235
|
results: TriggerResponse[];
|
|
224
|
-
triggered_check_ids: string[];
|
|
225
236
|
}
|
|
226
237
|
export interface RetryConfig {
|
|
227
238
|
count: number;
|
|
@@ -299,6 +310,7 @@ export interface Suite {
|
|
|
299
310
|
export interface Summary {
|
|
300
311
|
criticalErrors: number;
|
|
301
312
|
failed: number;
|
|
313
|
+
failedNonBlocking: number;
|
|
302
314
|
passed: number;
|
|
303
315
|
skipped: number;
|
|
304
316
|
testsNotFound: Set<string>;
|
|
@@ -309,17 +321,6 @@ export interface TestSearchResult {
|
|
|
309
321
|
public_id: string;
|
|
310
322
|
}[];
|
|
311
323
|
}
|
|
312
|
-
export interface APIHelper {
|
|
313
|
-
getPresignedURL(testIds: string[]): Promise<{
|
|
314
|
-
url: string;
|
|
315
|
-
}>;
|
|
316
|
-
getTest(testId: string): Promise<Test>;
|
|
317
|
-
pollResults(resultIds: string[]): Promise<{
|
|
318
|
-
results: PollResult[];
|
|
319
|
-
}>;
|
|
320
|
-
searchTests(query: string): Promise<TestSearchResult>;
|
|
321
|
-
triggerTests(payload: Payload): Promise<Trigger>;
|
|
322
|
-
}
|
|
323
324
|
export interface APIConfiguration {
|
|
324
325
|
apiKey: string;
|
|
325
326
|
appKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/commands/synthetics/interfaces.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/commands/synthetics/interfaces.ts"],"names":[],"mappings":";;;AAiBA,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,6BAAmB,CAAA;IACnB,uCAA6B,CAAA;IAC7B,mCAAyB,CAAA;AAC3B,CAAC,EAJW,MAAM,GAAN,cAAM,KAAN,cAAM,QAIjB;AAmLD,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB,iCAAqB,CAAA;IACrB,6CAAiC,CAAA;IACjC,qBAAS,CAAA;IACT,2BAAe,CAAA;IACf,yCAA6B,CAAA;IAC7B,yCAA6B,CAAA;IAC7B,iCAAqB,CAAA;IACrB,+CAAmC,CAAA;IACnC,iCAAqB,CAAA;IACrB,+CAAmC,CAAA;IACnC,+BAAmB,CAAA;IACnB,yCAA6B,CAAA;IAC7B,mDAAuC,CAAA;IACvC,6CAAiC,CAAA;AACnC,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB;AAmGD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,8CAA6B,CAAA;IAC7B,oCAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseContext } from 'clipanion';
|
|
2
|
-
import { ConfigOverride, ExecutionRule,
|
|
2
|
+
import { ConfigOverride, ExecutionRule, MainReporter, Result, Summary, Test } from '../interfaces';
|
|
3
3
|
export declare class DefaultReporter implements MainReporter {
|
|
4
4
|
private write;
|
|
5
5
|
constructor({ context }: {
|
|
@@ -11,10 +11,10 @@ export declare class DefaultReporter implements MainReporter {
|
|
|
11
11
|
reportStart(timings: {
|
|
12
12
|
startTime: number;
|
|
13
13
|
}): void;
|
|
14
|
+
resultEnd(result: Result, baseUrl: string): void;
|
|
15
|
+
resultReceived(result: Result): void;
|
|
14
16
|
runEnd(summary: Summary): void;
|
|
15
|
-
testEnd(test: Test, results: PollResult[], baseUrl: string, locationNames: LocationsMapping, failOnCriticalErrors: boolean, failOnTimeout: boolean): void;
|
|
16
|
-
testResult(response: TriggerResponse, result: PollResult): void;
|
|
17
17
|
testsWait(tests: Test[]): void;
|
|
18
|
-
testTrigger(test: Test, testId: string, executionRule: ExecutionRule, config: ConfigOverride): void;
|
|
18
|
+
testTrigger(test: Pick<Test, 'name'>, testId: string, executionRule: ExecutionRule, config: ConfigOverride): void;
|
|
19
19
|
testWait(test: Test): void;
|
|
20
20
|
}
|
|
@@ -23,6 +23,7 @@ const renderStepDuration = (duration) => {
|
|
|
23
23
|
};
|
|
24
24
|
const ICONS = {
|
|
25
25
|
FAILED: chalk_1.default.bold.red('✖'),
|
|
26
|
+
FAILED_NON_BLOCKING: chalk_1.default.bold.yellow('✖'),
|
|
26
27
|
SKIPPED: chalk_1.default.bold.yellow('⇢'),
|
|
27
28
|
SUCCESS: chalk_1.default.bold.green('✓'),
|
|
28
29
|
};
|
|
@@ -38,8 +39,8 @@ const renderStepIcon = (step) => {
|
|
|
38
39
|
const renderStep = (step) => {
|
|
39
40
|
const duration = renderStepDuration(step.duration);
|
|
40
41
|
const icon = renderStepIcon(step);
|
|
41
|
-
const value = step.value ? `\n
|
|
42
|
-
const error = step.error ? `\n
|
|
42
|
+
const value = step.value ? `\n ${chalk_1.default.dim(step.value)}` : '';
|
|
43
|
+
const error = step.error ? `\n ${chalk_1.default.red.dim(step.error)}` : '';
|
|
43
44
|
return ` ${icon} | ${duration} - ${step.description}${value}${error}`;
|
|
44
45
|
};
|
|
45
46
|
const readableOperation = {
|
|
@@ -62,32 +63,32 @@ const renderApiError = (errorCode, errorMessage, color) => {
|
|
|
62
63
|
if (errorCode === 'INCORRECT_ASSERTION') {
|
|
63
64
|
try {
|
|
64
65
|
const assertionsErrors = JSON.parse(errorMessage);
|
|
65
|
-
const output = ['
|
|
66
|
+
const output = [' - Assertion(s) failed:'];
|
|
66
67
|
output.push(...assertionsErrors.map((error) => {
|
|
67
68
|
const expected = chalk_1.default.underline(`${error.target}`);
|
|
68
69
|
const actual = chalk_1.default.underline(`${error.actual}`);
|
|
69
70
|
return `▶ ${error.type} ${readableOperation[error.operator]} ${expected}. Actual: ${actual}`;
|
|
70
71
|
}));
|
|
71
|
-
return color(output.join('\n
|
|
72
|
+
return color(output.join('\n '));
|
|
72
73
|
}
|
|
73
74
|
catch (e) {
|
|
74
75
|
// JSON parsing failed, do nothing to return the raw error
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
return chalk_1.default.red(`
|
|
78
|
+
return chalk_1.default.red(` [${chalk_1.default.bold(errorCode)}] - ${chalk_1.default.dim(errorMessage)}`);
|
|
78
79
|
};
|
|
79
80
|
// Test execution rendering
|
|
80
|
-
const renderResultOutcome = (result, test, icon, color
|
|
81
|
+
const renderResultOutcome = (result, test, icon, color) => {
|
|
81
82
|
// Only display critical errors if failure is not filled.
|
|
82
83
|
if (result.error && !(result.failure || result.errorMessage)) {
|
|
83
|
-
return `
|
|
84
|
+
return ` ${chalk_1.default.bold(`${ICONS.FAILED} | ${result.error}`)}`;
|
|
84
85
|
}
|
|
85
86
|
if (result.unhealthy) {
|
|
86
87
|
const errorMessage = result.failure ? result.failure.message : result.errorMessage;
|
|
87
88
|
const errorName = errorMessage && errorMessage !== 'Unknown error' ? errorMessage : 'General Error';
|
|
88
89
|
return [
|
|
89
|
-
`
|
|
90
|
-
`
|
|
90
|
+
` ${chalk_1.default.yellow(`${ICONS.SKIPPED} | ${errorName}`)}`,
|
|
91
|
+
` ${chalk_1.default.yellow('We had an error during the execution of this test. The result will be ignored')}`,
|
|
91
92
|
].join('\n');
|
|
92
93
|
}
|
|
93
94
|
if (test.type === 'api') {
|
|
@@ -95,12 +96,12 @@ const renderResultOutcome = (result, test, icon, color, failOnCriticalErrors, fa
|
|
|
95
96
|
if (result.failure || (result.errorCode && result.errorMessage)) {
|
|
96
97
|
const errorCode = result.failure ? result.failure.code : result.errorCode;
|
|
97
98
|
const errorMessage = result.failure ? result.failure.message : result.errorMessage;
|
|
98
|
-
return [`
|
|
99
|
+
return [` ${icon} ${color(requestDescription)}`, renderApiError(errorCode, errorMessage, color)].join('\n');
|
|
99
100
|
}
|
|
100
|
-
return `
|
|
101
|
+
return ` ${icon} ${color(requestDescription)}`;
|
|
101
102
|
}
|
|
102
103
|
if (test.type === 'browser') {
|
|
103
|
-
if (!
|
|
104
|
+
if (!result.passed && 'stepDetails' in result) {
|
|
104
105
|
// We render the step only if the test hasn't passed to avoid cluttering the output.
|
|
105
106
|
return result.stepDetails.map(renderStep).join('\n');
|
|
106
107
|
}
|
|
@@ -143,49 +144,43 @@ const getResultUrl = (baseUrl, test, resultId) => {
|
|
|
143
144
|
}
|
|
144
145
|
return `${testDetailUrl}?resultId=${resultId}&${ciQueryParam}`;
|
|
145
146
|
};
|
|
146
|
-
const renderExecutionResult = (test, execution, baseUrl
|
|
147
|
+
const renderExecutionResult = (test, execution, baseUrl) => {
|
|
147
148
|
var _a;
|
|
148
|
-
const {
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
const { test: overriddenTest, resultId, result } = execution;
|
|
150
|
+
const resultOutcome = utils_1.getResultOutcome(execution);
|
|
151
|
+
const [icon, setColor] = getResultIconAndColor(resultOutcome);
|
|
152
|
+
const executionRule = utils_1.getExecutionRule(test, (_a = execution.enrichment) === null || _a === void 0 ? void 0 : _a.config_override);
|
|
153
|
+
const executionRuleText = ["passed" /* Passed */, "passed-non-blocking" /* PassedNonBlocking */].includes(resultOutcome)
|
|
154
|
+
? ''
|
|
155
|
+
: `[${setColor(executionRule === interfaces_1.ExecutionRule.BLOCKING ? 'blocking' : 'non-blocking')}] `;
|
|
156
|
+
const testLabel = `${executionRuleText}[${chalk_1.default.bold.dim(test.public_id)}] ${chalk_1.default.bold(test.name)}`;
|
|
157
|
+
const location = setColor(`location: ${chalk_1.default.bold(execution.location)}`);
|
|
158
|
+
const device = test.type === 'browser' && 'device' in result ? ` - ${setColor(`device: ${chalk_1.default.bold(result.device.id)}`)}` : '';
|
|
159
|
+
const resultIdentification = `${icon} ${testLabel} - ${location}${device}`;
|
|
155
160
|
const outputLines = [resultIdentification];
|
|
156
161
|
// Unhealthy test results don't have a duration or result URL
|
|
157
162
|
if (!result.unhealthy) {
|
|
158
163
|
const duration = utils_1.getResultDuration(result);
|
|
159
|
-
const durationText = duration ? `
|
|
160
|
-
const resultUrl = getResultUrl(baseUrl, test,
|
|
164
|
+
const durationText = duration ? ` Total duration: ${duration} ms -` : '';
|
|
165
|
+
const resultUrl = getResultUrl(baseUrl, test, resultId);
|
|
161
166
|
const resultUrlStatus = result.error === interfaces_1.ERRORS.TIMEOUT ? '(not yet received)' : '';
|
|
162
|
-
const resultInfo = `
|
|
167
|
+
const resultInfo = ` ⎋${durationText} Result URL: ${chalk_1.default.dim.cyan(resultUrl)} ${resultUrlStatus}`;
|
|
163
168
|
outputLines.push(resultInfo);
|
|
164
169
|
}
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
outputLines.push(
|
|
170
|
+
const resultOutcomeText = renderResultOutcome(result, overriddenTest || test, icon, setColor);
|
|
171
|
+
if (resultOutcomeText) {
|
|
172
|
+
outputLines.push(resultOutcomeText);
|
|
168
173
|
}
|
|
169
174
|
return outputLines.join('\n');
|
|
170
175
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return ICONS.SUCCESS;
|
|
176
|
+
const getResultIconAndColor = (resultOutcome) => {
|
|
177
|
+
if (resultOutcome === "passed" /* Passed */ || resultOutcome === "passed-non-blocking" /* PassedNonBlocking */) {
|
|
178
|
+
return [ICONS.SUCCESS, chalk_1.default.bold.green];
|
|
175
179
|
}
|
|
176
|
-
if (
|
|
177
|
-
return ICONS.
|
|
178
|
-
}
|
|
179
|
-
return ICONS.FAILED;
|
|
180
|
-
};
|
|
181
|
-
const getTestResultColor = (success, isNonBlocking) => {
|
|
182
|
-
if (success) {
|
|
183
|
-
return chalk_1.default.bold.green;
|
|
184
|
-
}
|
|
185
|
-
if (isNonBlocking) {
|
|
186
|
-
return chalk_1.default.bold.yellow;
|
|
180
|
+
if (resultOutcome === "failed-non-blocking" /* FailedNonBlocking */) {
|
|
181
|
+
return [ICONS.FAILED_NON_BLOCKING, chalk_1.default.bold.yellow];
|
|
187
182
|
}
|
|
188
|
-
return chalk_1.default.bold.red;
|
|
183
|
+
return [ICONS.FAILED, chalk_1.default.bold.red];
|
|
189
184
|
};
|
|
190
185
|
class DefaultReporter {
|
|
191
186
|
constructor({ context }) {
|
|
@@ -204,43 +199,36 @@ class DefaultReporter {
|
|
|
204
199
|
const delay = (Date.now() - timings.startTime).toString();
|
|
205
200
|
this.write(['', chalk_1.default.bold.cyan('=== REPORT ==='), `Took ${chalk_1.default.bold(delay)}ms`, '\n'].join('\n'));
|
|
206
201
|
}
|
|
202
|
+
resultEnd(result, baseUrl) {
|
|
203
|
+
this.write(renderExecutionResult(result.test, result, baseUrl) + '\n\n');
|
|
204
|
+
}
|
|
205
|
+
resultReceived(result) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
207
208
|
runEnd(summary) {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
const { bold: b, gray, green, red, yellow } = chalk_1.default;
|
|
210
|
+
const lines = [];
|
|
211
|
+
const runSummary = [green(`${b(summary.passed)} passed`), red(`${b(summary.failed)} failed`)];
|
|
212
|
+
if (summary.failedNonBlocking) {
|
|
213
|
+
runSummary.push(yellow(`${b(summary.failedNonBlocking)} failed (non-blocking)`));
|
|
214
|
+
}
|
|
212
215
|
if (summary.skipped) {
|
|
213
|
-
|
|
216
|
+
runSummary.push(`${b(summary.skipped)} skipped`);
|
|
214
217
|
}
|
|
215
218
|
if (summary.testsNotFound.size > 0) {
|
|
216
|
-
const
|
|
217
|
-
|
|
219
|
+
const testsNotFoundListStr = gray(`(${[...summary.testsNotFound].join(', ')})`);
|
|
220
|
+
lines.push(`${yellow(`${b(summary.testsNotFound.size)} ${pluralize('test', summary.testsNotFound.size)} not found`)} ${testsNotFoundListStr}`);
|
|
218
221
|
}
|
|
219
222
|
const extraInfo = [];
|
|
220
223
|
if (summary.timedOut) {
|
|
221
|
-
extraInfo.push(
|
|
224
|
+
extraInfo.push(yellow(`${b(summary.timedOut)} timed out`));
|
|
222
225
|
}
|
|
223
226
|
if (summary.criticalErrors) {
|
|
224
|
-
extraInfo.push(
|
|
227
|
+
extraInfo.push(red(`${b(summary.criticalErrors)} critical errors`));
|
|
225
228
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var _a;
|
|
230
|
-
const success = utils_1.hasTestSucceeded(results, failOnCriticalErrors, failOnTimeout);
|
|
231
|
-
const isNonBlocking = ((_a = test.options.ci) === null || _a === void 0 ? void 0 : _a.executionRule) === interfaces_1.ExecutionRule.NON_BLOCKING;
|
|
232
|
-
const icon = renderResultIcon(success, isNonBlocking);
|
|
233
|
-
const idDisplay = `[${chalk_1.default.bold.dim(test.public_id)}]`;
|
|
234
|
-
const nameColor = getTestResultColor(success, isNonBlocking);
|
|
235
|
-
const nonBlockingText = !success && isNonBlocking ? '[NON-BLOCKING]' : '';
|
|
236
|
-
const testResultsText = results
|
|
237
|
-
.map((r) => renderExecutionResult(test, r, baseUrl, locationNames, failOnCriticalErrors, failOnTimeout))
|
|
238
|
-
.join('\n\n')
|
|
239
|
-
.concat('\n\n');
|
|
240
|
-
this.write([`${icon} ${idDisplay}${nonBlockingText} | ${nameColor(test.name)}`, testResultsText].join('\n'));
|
|
241
|
-
}
|
|
242
|
-
testResult(response, result) {
|
|
243
|
-
return;
|
|
229
|
+
const extraInfoStr = extraInfo.length ? ' (' + extraInfo.join(', ') + ')' : '';
|
|
230
|
+
lines.push(`${b('Run summary:')} ${runSummary.join(', ')}${extraInfoStr}\n\n`);
|
|
231
|
+
this.write(lines.join('\n'));
|
|
244
232
|
}
|
|
245
233
|
testsWait(tests) {
|
|
246
234
|
const testsList = tests.map((t) => t.public_id);
|
|
@@ -249,7 +237,7 @@ class DefaultReporter {
|
|
|
249
237
|
testsList.push('…');
|
|
250
238
|
}
|
|
251
239
|
const testsDisplay = chalk_1.default.gray(`(${testsList.join(', ')})`);
|
|
252
|
-
this.write(`Waiting for ${chalk_1.default.bold.cyan(tests.length)} test
|
|
240
|
+
this.write(`Waiting for ${chalk_1.default.bold.cyan(tests.length)} test ${pluralize('result', tests.length)} ${testsDisplay}…\n`);
|
|
253
241
|
}
|
|
254
242
|
testTrigger(test, testId, executionRule, config) {
|
|
255
243
|
const idDisplay = `[${chalk_1.default.bold.dim(testId)}]`;
|
|
@@ -269,11 +257,19 @@ class DefaultReporter {
|
|
|
269
257
|
}
|
|
270
258
|
return `Found test "${chalk_1.default.green.bold(test.name)}"`;
|
|
271
259
|
};
|
|
272
|
-
|
|
260
|
+
const getConfigOverridesPart = () => {
|
|
261
|
+
const nbConfigsOverridden = Object.keys(config).length;
|
|
262
|
+
if (nbConfigsOverridden === 0) {
|
|
263
|
+
return '';
|
|
264
|
+
}
|
|
265
|
+
return ' ' + chalk_1.default.gray(`(${nbConfigsOverridden} config ${pluralize('override', nbConfigsOverridden)})`);
|
|
266
|
+
};
|
|
267
|
+
this.write(`${idDisplay} ${getMessage()}${getConfigOverridesPart()}\n`);
|
|
273
268
|
}
|
|
274
269
|
testWait(test) {
|
|
275
270
|
return;
|
|
276
271
|
}
|
|
277
272
|
}
|
|
278
273
|
exports.DefaultReporter = DefaultReporter;
|
|
274
|
+
const pluralize = (word, count) => (count === 1 ? word : `${word}s`);
|
|
279
275
|
//# sourceMappingURL=default.js.map
|