@elastic/synthetics 1.0.0-beta.39 → 1.0.0-beta.40
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/dist/cli.js +11 -3
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +1 -2
- package/dist/common_types.d.ts.map +1 -1
- package/dist/core/browser-service.js +3 -2
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/gatherer.js +1 -0
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +27 -40
- package/dist/core/runner.js.map +1 -1
- package/dist/core/transform.d.ts +37 -0
- package/dist/core/transform.d.ts.map +1 -0
- package/dist/core/transform.js +148 -0
- package/dist/core/transform.js.map +1 -0
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +9 -2
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +14 -1
- package/dist/dsl/monitor.d.ts.map +1 -1
- package/dist/dsl/monitor.js +26 -0
- package/dist/dsl/monitor.js.map +1 -1
- package/dist/dsl/step.js +4 -0
- package/dist/dsl/step.js.map +1 -1
- package/dist/formatter/javascript.js +3 -0
- package/dist/formatter/javascript.js.map +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +12 -9
- package/dist/generator/index.js.map +1 -1
- package/dist/helpers.d.ts +5 -5
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +30 -17
- package/dist/helpers.js.map +1 -1
- package/dist/loader.d.ts +7 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +16 -19
- package/dist/loader.js.map +1 -1
- package/dist/locations/index.d.ts.map +1 -1
- package/dist/locations/index.js +4 -11
- package/dist/locations/index.js.map +1 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +21 -5
- package/dist/options.js.map +1 -1
- package/dist/plugins/browser-console.js +28 -27
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/network.js +5 -3
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.js +1 -0
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.js +8 -7
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.js +2 -0
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/push/bundler.d.ts.map +1 -1
- package/dist/push/bundler.js +10 -17
- package/dist/push/bundler.js.map +1 -1
- package/dist/push/index.d.ts +1 -30
- package/dist/push/index.d.ts.map +1 -1
- package/dist/push/index.js +76 -66
- package/dist/push/index.js.map +1 -1
- package/dist/push/kibana_api.d.ts +56 -0
- package/dist/push/kibana_api.d.ts.map +1 -0
- package/dist/push/kibana_api.js +135 -0
- package/dist/push/kibana_api.js.map +1 -0
- package/dist/push/monitor.d.ts +14 -6
- package/dist/push/monitor.d.ts.map +1 -1
- package/dist/push/monitor.js +61 -18
- package/dist/push/monitor.js.map +1 -1
- package/dist/push/plugin.d.ts +7 -7
- package/dist/push/plugin.d.ts.map +1 -1
- package/dist/push/plugin.js +25 -136
- package/dist/push/plugin.js.map +1 -1
- package/dist/push/request.d.ts +4 -2
- package/dist/push/request.d.ts.map +1 -1
- package/dist/push/request.js +28 -3
- package/dist/push/request.js.map +1 -1
- package/dist/push/utils.d.ts +31 -0
- package/dist/push/utils.d.ts.map +1 -0
- package/dist/push/utils.js +64 -0
- package/dist/push/utils.js.map +1 -0
- package/dist/reporters/base.js +7 -5
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/junit.js +11 -21
- package/dist/reporters/junit.js.map +1 -1
- package/package.json +5 -5
- package/src/cli.ts +10 -4
- package/src/common_types.ts +1 -2
- package/src/core/runner.ts +0 -3
- package/src/core/transform.ts +160 -0
- package/src/dsl/journey.ts +1 -0
- package/src/dsl/monitor.ts +27 -1
- package/src/generator/index.ts +10 -12
- package/src/helpers.ts +31 -17
- package/src/loader.ts +15 -19
- package/src/locations/index.ts +6 -19
- package/src/options.ts +21 -5
- package/src/push/bundler.ts +8 -15
- package/src/push/index.ts +111 -85
- package/src/push/kibana_api.ts +191 -0
- package/src/push/monitor.ts +72 -35
- package/src/push/plugin.ts +23 -125
- package/src/push/request.ts +38 -3
- package/src/push/utils.ts +77 -0
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/push/plugin.js
CHANGED
|
@@ -23,155 +23,44 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
-
if (k2 === undefined) k2 = k;
|
|
28
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
-
}
|
|
32
|
-
Object.defineProperty(o, k2, desc);
|
|
33
|
-
}) : (function(o, m, k, k2) {
|
|
34
|
-
if (k2 === undefined) k2 = k;
|
|
35
|
-
o[k2] = m[k];
|
|
36
|
-
}));
|
|
37
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
-
}) : function(o, v) {
|
|
40
|
-
o["default"] = v;
|
|
41
|
-
});
|
|
42
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
43
|
-
if (mod && mod.__esModule) return mod;
|
|
44
|
-
var result = {};
|
|
45
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
46
|
-
__setModuleDefault(result, mod);
|
|
47
|
-
return result;
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
27
|
+
exports.SyntheticsBundlePlugin = void 0;
|
|
54
28
|
const path_1 = require("path");
|
|
55
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
56
|
-
const esbuild = __importStar(require("esbuild"));
|
|
57
|
-
// ROOT directory of the Package - /
|
|
58
|
-
const ROOT_DIR = (0, path_1.join)(__dirname, '..', '..');
|
|
59
29
|
// Source of the package - /src, /dist, etc.
|
|
60
30
|
const SOURCE_DIR = (0, path_1.join)(__dirname, '..');
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
outExtension: {
|
|
78
|
-
'.js': '.js',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
exports.commonOptions = commonOptions;
|
|
83
|
-
function MultiAssetPlugin(callback) {
|
|
84
|
-
// Check that the path isn't in an external package by making sure it's at a standard
|
|
85
|
-
// local filesystem location
|
|
86
|
-
const isBare = (str) => {
|
|
87
|
-
// Note that we use `isAbsolute` to handle UNC/windows style paths like C:\path\to\thing
|
|
88
|
-
// This is not necessary for relative directories since `.\file` is not supported as an import
|
|
89
|
-
// nor is `~/path/to/file`.
|
|
90
|
-
if ((0, path_1.isAbsolute)(str) || str.startsWith('./') || str.startsWith('../')) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
};
|
|
95
|
-
// If we're importing the @elastic/synthetics package
|
|
96
|
-
// directly from source instead of using the fully
|
|
97
|
-
// qualified name, we must skip it too. That's just
|
|
98
|
-
// so it doesn't get bundled on tests or when we locally
|
|
99
|
-
// refer to the package itself.
|
|
100
|
-
const isLocalSynthetics = (entryPath) => {
|
|
101
|
-
return entryPath.startsWith(SOURCE_DIR);
|
|
102
|
-
};
|
|
103
|
-
// When importing the local synthetics module directly
|
|
104
|
-
// it may import its own local dependencies, so we must
|
|
105
|
-
// make sure those will be resolved using Node's resolution
|
|
106
|
-
// algorithm, as they're still "node_modules" that we must bundle
|
|
107
|
-
const isLocalSyntheticsModule = (str) => {
|
|
108
|
-
return str.startsWith(SOURCE_NODE_MODULES);
|
|
109
|
-
};
|
|
31
|
+
/**
|
|
32
|
+
* Avoid importing @elastic/synthetics package from source, this avoids
|
|
33
|
+
* bundling the synthetics package in tests or when resolved using
|
|
34
|
+
* absolute paths.
|
|
35
|
+
* ex: import {journey} from "../../"
|
|
36
|
+
*/
|
|
37
|
+
const isLocalSynthetics = (resolvedPath) => {
|
|
38
|
+
return resolvedPath.startsWith(SOURCE_DIR);
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Esbuild Plugin to create separate bundles for all the journeys.
|
|
42
|
+
* Treats journeys as the entry point and bundles all the dependencies
|
|
43
|
+
* including the node_modules and ignores bundling the synthetics package
|
|
44
|
+
* when imported externally or from source.
|
|
45
|
+
*/
|
|
46
|
+
function SyntheticsBundlePlugin() {
|
|
110
47
|
return {
|
|
111
|
-
name: '
|
|
48
|
+
name: 'synthetics-bundle-plugin',
|
|
112
49
|
setup(build) {
|
|
113
50
|
build.onResolve({ filter: /.*?/ }, async (args) => {
|
|
114
|
-
//
|
|
115
|
-
// be removed from the bundle
|
|
116
|
-
if (build.initialOptions.external?.includes(args.path)) {
|
|
117
|
-
return {
|
|
118
|
-
external: true,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (!isBare(args.path) ||
|
|
122
|
-
args.importer.includes('/node_modules/') ||
|
|
123
|
-
isLocalSyntheticsModule(args.importer)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
51
|
+
// Ignore entry points as these refer to the journey files
|
|
126
52
|
if (args.kind === 'entry-point') {
|
|
127
|
-
return
|
|
128
|
-
path: args.path,
|
|
129
|
-
namespace: 'journey',
|
|
130
|
-
};
|
|
53
|
+
return;
|
|
131
54
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const entryPath = (0, path_1.join)((0, path_1.dirname)(args.importer), args.path) + (0, path_1.extname)(args.importer);
|
|
135
|
-
if (isLocalSynthetics(entryPath)) {
|
|
55
|
+
const resolvedPath = (0, path_1.join)(args.resolveDir, args.path);
|
|
56
|
+
if (isLocalSynthetics(resolvedPath)) {
|
|
136
57
|
return { external: true };
|
|
137
58
|
}
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
...commonOptions(),
|
|
141
|
-
entryPoints: {
|
|
142
|
-
[entryPath]: entryPath,
|
|
143
|
-
},
|
|
144
|
-
bundle: false,
|
|
145
|
-
external: [],
|
|
146
|
-
});
|
|
147
|
-
callback({
|
|
148
|
-
path: entryPath,
|
|
149
|
-
contents: result.outputFiles[0].text,
|
|
150
|
-
});
|
|
151
|
-
return {
|
|
152
|
-
errors: result.errors,
|
|
153
|
-
external: true,
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
build.onLoad({ filter: /.*?/, namespace: 'journey' }, async (args) => {
|
|
157
|
-
const contents = await promises_1.default.readFile(args.path, 'utf-8');
|
|
158
|
-
callback({ path: args.path, contents });
|
|
159
|
-
// Use correct loader for the journey entry path
|
|
160
|
-
let loader = 'default';
|
|
161
|
-
const ext = (0, path_1.extname)(args.path).slice(1);
|
|
162
|
-
if (ext === 'cjs' || ext === 'mjs') {
|
|
163
|
-
loader = 'js';
|
|
164
|
-
}
|
|
165
|
-
else if (ext === 'cts' || ext === 'mts') {
|
|
166
|
-
loader = 'ts';
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
loader = ext;
|
|
170
|
-
}
|
|
171
|
-
return { contents, loader };
|
|
59
|
+
// Allow esbuild to resolve the module
|
|
60
|
+
return;
|
|
172
61
|
});
|
|
173
62
|
},
|
|
174
63
|
};
|
|
175
64
|
}
|
|
176
|
-
exports.
|
|
65
|
+
exports.SyntheticsBundlePlugin = SyntheticsBundlePlugin;
|
|
177
66
|
//# sourceMappingURL=plugin.js.map
|
package/dist/push/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/push/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/push/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,+BAA4B;AAG5B,4CAA4C;AAC5C,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,YAAoB,EAAE,EAAE;IACjD,OAAO,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,sBAAsB;IACpC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;gBAC9C,0DAA0D;gBAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE;oBAC/B,OAAO;iBACR;gBACD,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtD,IAAI,iBAAiB,CAAC,YAAY,CAAC,EAAE;oBACnC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iBAC3B;gBACD,sCAAsC;gBACtC,OAAO;YACT,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAlBD,wDAkBC"}
|
package/dist/push/request.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import { Dispatcher } from 'undici';
|
|
25
|
+
import type { Dispatcher } from 'undici';
|
|
26
26
|
export declare type APIRequestOptions = {
|
|
27
27
|
url: string;
|
|
28
28
|
method: Dispatcher.HttpMethod;
|
|
@@ -30,13 +30,15 @@ export declare type APIRequestOptions = {
|
|
|
30
30
|
body?: string;
|
|
31
31
|
};
|
|
32
32
|
export declare function sendRequest(options: APIRequestOptions): Promise<Dispatcher.ResponseData>;
|
|
33
|
+
export declare function sendReqAndHandleError<T>(options: APIRequestOptions): Promise<T>;
|
|
34
|
+
export declare function handleError(statusCode: number, url: string, body: Dispatcher.ResponseData['body']): Promise<Dispatcher.ResponseData['body']>;
|
|
33
35
|
export declare function ok(statusCode: number): boolean;
|
|
34
36
|
export declare type APIMonitorError = {
|
|
35
37
|
id?: string;
|
|
36
38
|
reason: string;
|
|
37
39
|
details: string;
|
|
38
40
|
};
|
|
39
|
-
export declare function formatNotFoundError(message: string): string;
|
|
41
|
+
export declare function formatNotFoundError(url: string, message: string): string;
|
|
40
42
|
export declare function formatAPIError(statuCode: number, error: string, message: string): string;
|
|
41
43
|
export declare function formatFailedMonitors(errors: APIMonitorError[]): string;
|
|
42
44
|
export declare function formatStaleMonitors(errors: APIMonitorError[]): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOzC,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAsB,WAAW,CAAC,OAAO,EAAE,iBAAiB,oCAY3D;AAED,wBAAsB,qBAAqB,CAAC,CAAC,EAC3C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CAGZ;AAKD,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,GACpC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAkB1C;AAED,wBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,WAEpC;AAED,oBAAY,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAM/D;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,UAShB;AAcD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,UAG7D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,EAAE,UAG5D"}
|
package/dist/push/request.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.formatStaleMonitors = exports.formatFailedMonitors = exports.formatAPIError = exports.formatNotFoundError = exports.ok = exports.sendRequest = void 0;
|
|
27
|
+
exports.formatStaleMonitors = exports.formatFailedMonitors = exports.formatAPIError = exports.formatNotFoundError = exports.ok = exports.handleError = exports.sendReqAndHandleError = exports.sendRequest = void 0;
|
|
28
28
|
const colors_1 = require("kleur/colors");
|
|
29
29
|
const undici_1 = require("undici");
|
|
30
30
|
const helpers_1 = require("../helpers");
|
|
@@ -44,12 +44,37 @@ async function sendRequest(options) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
exports.sendRequest = sendRequest;
|
|
47
|
+
async function sendReqAndHandleError(options) {
|
|
48
|
+
const { statusCode, body } = await sendRequest(options);
|
|
49
|
+
return await (await handleError(statusCode, options.url, body)).json();
|
|
50
|
+
}
|
|
51
|
+
exports.sendReqAndHandleError = sendReqAndHandleError;
|
|
52
|
+
// Handle bad status code errors from Kibana API and format the
|
|
53
|
+
// error message to be displayed to the user.
|
|
54
|
+
// returns the response stream if no error is found
|
|
55
|
+
async function handleError(statusCode, url, body) {
|
|
56
|
+
if (statusCode === 404) {
|
|
57
|
+
throw formatNotFoundError(url, await body.text());
|
|
58
|
+
}
|
|
59
|
+
else if (!ok(statusCode)) {
|
|
60
|
+
let parsed;
|
|
61
|
+
try {
|
|
62
|
+
parsed = await body.json();
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
throw formatAPIError(statusCode, 'unexpected non-JSON error', await body.text());
|
|
66
|
+
}
|
|
67
|
+
throw formatAPIError(statusCode, parsed.error, parsed.message);
|
|
68
|
+
}
|
|
69
|
+
return body;
|
|
70
|
+
}
|
|
71
|
+
exports.handleError = handleError;
|
|
47
72
|
function ok(statusCode) {
|
|
48
73
|
return statusCode >= 200 && statusCode <= 299;
|
|
49
74
|
}
|
|
50
75
|
exports.ok = ok;
|
|
51
|
-
function formatNotFoundError(message) {
|
|
52
|
-
return (0, colors_1.red)((0, colors_1.bold)(`${helpers_1.symbols['failed']} Please check your kibana url and try again - 404:${message}`));
|
|
76
|
+
function formatNotFoundError(url, message) {
|
|
77
|
+
return (0, colors_1.red)((0, colors_1.bold)(`${helpers_1.symbols['failed']} Please check your kibana url: ${url} and try again - 404:${message}`));
|
|
53
78
|
}
|
|
54
79
|
exports.formatNotFoundError = formatNotFoundError;
|
|
55
80
|
function formatAPIError(statuCode, error, message) {
|
package/dist/push/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,yCAAiD;
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,yCAAiD;AAEjD,mCAAiC;AACjC,wCAA6C;AAE7C,uDAAuD;AACvD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAS3C,KAAK,UAAU,WAAW,CAAC,OAA0B;IAC1D,OAAO,MAAM,IAAA,gBAAO,EAAC,OAAO,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,EAAE;YACvC,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,sBAAsB,OAAO,EAAE;YAC7C,UAAU,EAAE,MAAM;SACnB;QACD,cAAc,EAAE,EAAE,GAAG,IAAI;KAC1B,CAAC,CAAC;AACL,CAAC;AAZD,kCAYC;AAEM,KAAK,UAAU,qBAAqB,CACzC,OAA0B;IAE1B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC;AALD,sDAKC;AAED,+DAA+D;AAC/D,6CAA6C;AAC7C,m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
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
import { PushOptions } from '../common_types';
|
|
26
|
+
export declare function logDiff<T extends Set<string>>(newIDs: T, changedIDs: T, removedIDs: T, unchangedIDs: T): void;
|
|
27
|
+
export declare function getChunks(arr: any[], size: number): any[];
|
|
28
|
+
declare type Operation = 'status' | 'bulk_get' | 'bulk_update' | 'bulk_delete' | 'legacy' | 'location';
|
|
29
|
+
export declare function generateURL(options: PushOptions, operation: Operation): string;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/push/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wBAAgB,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAC3C,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,EACb,YAAY,EAAE,CAAC,QAShB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,SAMjD;AAED,aAAK,SAAS,GACV,QAAQ,GACR,UAAU,GACV,aAAa,GACb,aAAa,GACb,QAAQ,GACR,UAAU,CAAC;AAEf,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,UAgBrE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.generateURL = exports.getChunks = exports.logDiff = void 0;
|
|
28
|
+
const helpers_1 = require("../helpers");
|
|
29
|
+
const colors_1 = require("kleur/colors");
|
|
30
|
+
function logDiff(newIDs, changedIDs, removedIDs, unchangedIDs) {
|
|
31
|
+
(0, helpers_1.progress)('Monitor Diff: ' +
|
|
32
|
+
(0, colors_1.green)(`Added(${newIDs.size}) `) +
|
|
33
|
+
(0, colors_1.yellow)(`Updated(${changedIDs.size}) `) +
|
|
34
|
+
(0, colors_1.red)(`Removed(${removedIDs.size}) `) +
|
|
35
|
+
(0, colors_1.grey)(`Unchanged(${unchangedIDs.size})`));
|
|
36
|
+
}
|
|
37
|
+
exports.logDiff = logDiff;
|
|
38
|
+
function getChunks(arr, size) {
|
|
39
|
+
const chunks = [];
|
|
40
|
+
for (let i = 0; i < arr.length; i += size) {
|
|
41
|
+
chunks.push(arr.slice(i, i + size));
|
|
42
|
+
}
|
|
43
|
+
return chunks;
|
|
44
|
+
}
|
|
45
|
+
exports.getChunks = getChunks;
|
|
46
|
+
function generateURL(options, operation) {
|
|
47
|
+
const url = (0, helpers_1.removeTrailingSlash)(options.url);
|
|
48
|
+
switch (operation) {
|
|
49
|
+
case 'status':
|
|
50
|
+
return `${url}/s/${options.space}/api/status`;
|
|
51
|
+
case 'bulk_get':
|
|
52
|
+
case 'bulk_update':
|
|
53
|
+
case 'bulk_delete':
|
|
54
|
+
return `${url}/s/${options.space}/api/synthetics/project/${options.id}/monitors`;
|
|
55
|
+
case 'legacy':
|
|
56
|
+
return `${url}/s/${options.space}/api/synthetics/service/project/monitors`;
|
|
57
|
+
case 'location':
|
|
58
|
+
return `${url}/internal/uptime/service/locations`;
|
|
59
|
+
default:
|
|
60
|
+
throw new Error('Invalid operation');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.generateURL = generateURL;
|
|
64
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/push/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,wCAA2D;AAC3D,yCAAwD;AAGxD,SAAgB,OAAO,CACrB,MAAS,EACT,UAAa,EACb,UAAa,EACb,YAAe;IAEf,IAAA,kBAAQ,EACN,gBAAgB;QACd,IAAA,cAAK,EAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC;QAC/B,IAAA,eAAM,EAAC,WAAW,UAAU,CAAC,IAAI,IAAI,CAAC;QACtC,IAAA,YAAG,EAAC,WAAW,UAAU,CAAC,IAAI,IAAI,CAAC;QACnC,IAAA,aAAI,EAAC,aAAa,YAAY,CAAC,IAAI,GAAG,CAAC,CAC1C,CAAC;AACJ,CAAC;AAbD,0BAaC;AAED,SAAgB,SAAS,CAAC,GAAU,EAAE,IAAY;IAChD,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE;QACzC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;KACrC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,8BAMC;AAUD,SAAgB,WAAW,CAAC,OAAoB,EAAE,SAAoB;IACpE,MAAM,GAAG,GAAG,IAAA,6BAAmB,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ;YACX,OAAO,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,aAAa,CAAC;QAChD,KAAK,UAAU,CAAC;QAChB,KAAK,aAAa,CAAC;QACnB,KAAK,aAAa;YAChB,OAAO,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,2BAA2B,OAAO,CAAC,EAAE,WAAW,CAAC;QACnF,KAAK,QAAQ;YACX,OAAO,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,0CAA0C,CAAC;QAC7E,KAAK,UAAU;YACb,OAAO,GAAG,GAAG,oCAAoC,CAAC;QACpD;YACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;KACxC;AACH,CAAC;AAhBD,kCAgBC"}
|
package/dist/reporters/base.js
CHANGED
|
@@ -52,12 +52,14 @@ function renderDuration(durationMs) {
|
|
|
52
52
|
return parseInt(durationMs);
|
|
53
53
|
}
|
|
54
54
|
class BaseReporter {
|
|
55
|
+
stream;
|
|
56
|
+
fd;
|
|
57
|
+
metrics = {
|
|
58
|
+
succeeded: 0,
|
|
59
|
+
failed: 0,
|
|
60
|
+
skipped: 0,
|
|
61
|
+
};
|
|
55
62
|
constructor(options = {}) {
|
|
56
|
-
this.metrics = {
|
|
57
|
-
succeeded: 0,
|
|
58
|
-
failed: 0,
|
|
59
|
-
skipped: 0,
|
|
60
|
-
};
|
|
61
63
|
this.fd = options.fd || process.stdout.fd;
|
|
62
64
|
/**
|
|
63
65
|
* minLength is set to 1 byte to make sure we flush the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/reporters/base.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;AAEH,4DAA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AS,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO;SACR;QAED,OAAO,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,IAAI,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,YAAG,EAAC,IAAI,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,aAAI,EAAC,IAAI,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,OAAO,IAAI,KAAK,cAAc,CAAC,IAAA,aAAG,GAAE,CAAC,SAAS,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEpB,uEAAuE;QACvE,yEAAyE;QACzE,cAAc;QACd,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE;YAC9B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SACnC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AA5ED,+BA4EC"}
|
package/dist/reporters/junit.js
CHANGED
|
@@ -23,15 +23,9 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
-
};
|
|
31
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
28
|
};
|
|
34
|
-
var _JUnitReporter_journeyMap;
|
|
35
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
30
|
const promises_1 = require("fs/promises");
|
|
37
31
|
const path_1 = require("path");
|
|
@@ -41,15 +35,12 @@ const base_1 = __importDefault(require("./base"));
|
|
|
41
35
|
* JUnit Reporting Format - https://llg.cubic.org/docs/junit/
|
|
42
36
|
*/
|
|
43
37
|
class JUnitReporter extends base_1.default {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.totalSkipped = 0;
|
|
49
|
-
_JUnitReporter_journeyMap.set(this, new Map());
|
|
50
|
-
}
|
|
38
|
+
totalTests = 0;
|
|
39
|
+
totalFailures = 0;
|
|
40
|
+
totalSkipped = 0;
|
|
41
|
+
#journeyMap = new Map();
|
|
51
42
|
onJourneyStart(journey, {}) {
|
|
52
|
-
if (!
|
|
43
|
+
if (!this.#journeyMap.has(journey.name)) {
|
|
53
44
|
const entry = {
|
|
54
45
|
name: 'testsuite',
|
|
55
46
|
attributes: {
|
|
@@ -61,14 +52,14 @@ class JUnitReporter extends base_1.default {
|
|
|
61
52
|
},
|
|
62
53
|
children: [],
|
|
63
54
|
};
|
|
64
|
-
|
|
55
|
+
this.#journeyMap.set(journey.name, entry);
|
|
65
56
|
}
|
|
66
57
|
}
|
|
67
58
|
onStepEnd(journey, step, { status, error, start, end }) {
|
|
68
|
-
if (!
|
|
59
|
+
if (!this.#journeyMap.has(journey.name)) {
|
|
69
60
|
return;
|
|
70
61
|
}
|
|
71
|
-
const entry =
|
|
62
|
+
const entry = this.#journeyMap.get(journey.name);
|
|
72
63
|
const caseEntry = {
|
|
73
64
|
name: 'testcase',
|
|
74
65
|
attributes: {
|
|
@@ -103,10 +94,10 @@ class JUnitReporter extends base_1.default {
|
|
|
103
94
|
entry.children.push(caseEntry);
|
|
104
95
|
}
|
|
105
96
|
onJourneyEnd(journey, {}) {
|
|
106
|
-
if (!
|
|
97
|
+
if (!this.#journeyMap.has(journey.name)) {
|
|
107
98
|
return;
|
|
108
99
|
}
|
|
109
|
-
const { attributes } =
|
|
100
|
+
const { attributes } = this.#journeyMap.get(journey.name);
|
|
110
101
|
this.totalTests += attributes.tests;
|
|
111
102
|
this.totalFailures += attributes.failures;
|
|
112
103
|
this.totalSkipped += attributes.skipped;
|
|
@@ -122,7 +113,7 @@ class JUnitReporter extends base_1.default {
|
|
|
122
113
|
errors: 0,
|
|
123
114
|
time: parseInt(String((0, helpers_1.now)())) / 1000,
|
|
124
115
|
},
|
|
125
|
-
children: [...
|
|
116
|
+
children: [...this.#journeyMap.values()],
|
|
126
117
|
};
|
|
127
118
|
const output = serializeEntries(root).join('\n');
|
|
128
119
|
/**
|
|
@@ -139,7 +130,6 @@ class JUnitReporter extends base_1.default {
|
|
|
139
130
|
}
|
|
140
131
|
}
|
|
141
132
|
exports.default = JUnitReporter;
|
|
142
|
-
_JUnitReporter_journeyMap = new WeakMap();
|
|
143
133
|
function escape(text) {
|
|
144
134
|
return text
|
|
145
135
|
.replace(/"/g, '"')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"junit.js","sourceRoot":"","sources":["../../src/reporters/junit.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"junit.js","sourceRoot":"","sources":["../../src/reporters/junit.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;AAEH,0CAA+C;AAC/C,+BAA+B;AAO/B,wCAAsD;AACtD,kDAAkC;AAkBlC;;GAEG;AACH,MAAqB,aAAc,SAAQ,cAAY;IAC7C,UAAU,GAAG,CAAC,CAAC;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AAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;SAC1D,IAAI,CAAC,GAAG,CAAC,GAAG,EACf,KAAK,CACN,CACF,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE;QACxC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;KAChD;IACD,IAAI,KAAK,CAAC,IAAI;QAAE,MAAM,CAAC,IAAI,CAAC,IAAA,gBAAM,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/D,MAAM,CAAC,IAAI,CAAC,IAAA,gBAAM,EAAC,KAAK,KAAK,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/synthetics",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.40",
|
|
4
4
|
"description": "Elastic synthetic monitoring agent",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"author": "",
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@cspotcode/source-map-support": "^0.8.1",
|
|
44
|
-
"@esbuild-plugins/node-resolve": "^0.1.4",
|
|
45
43
|
"archiver": "^5.3.1",
|
|
46
44
|
"commander": "^9.4.1",
|
|
47
45
|
"deepmerge": "^4.2.2",
|
|
48
46
|
"enquirer": "^2.3.6",
|
|
49
|
-
"esbuild": "^0.
|
|
47
|
+
"esbuild": "^0.16.10",
|
|
50
48
|
"expect": "^28.1.3",
|
|
51
49
|
"http-proxy": "^1.18.1",
|
|
52
50
|
"kleur": "^4.1.5",
|
|
53
51
|
"micromatch": "^4.0.5",
|
|
52
|
+
"pirates": "^4.0.5",
|
|
54
53
|
"playwright-chromium": "=1.27.1",
|
|
55
54
|
"playwright-core": "=1.27.1",
|
|
55
|
+
"semver": "^7.3.8",
|
|
56
56
|
"sharp": "^0.31.1",
|
|
57
57
|
"snakecase-keys": "^4.0.1",
|
|
58
58
|
"sonic-boom": "^3.2.0",
|
|
59
|
-
"
|
|
59
|
+
"source-map-support": "^0.5.21",
|
|
60
60
|
"typescript": "^4.8.4",
|
|
61
61
|
"undici": "^5.11.0",
|
|
62
62
|
"yaml": "^2.1.3"
|
package/src/cli.ts
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
parseThrottling,
|
|
35
35
|
getCommonCommandOpts,
|
|
36
36
|
} from './options';
|
|
37
|
-
import {
|
|
37
|
+
import { globalSetup } from './loader';
|
|
38
38
|
import { run } from './';
|
|
39
39
|
import { runner } from './core';
|
|
40
40
|
import { SyntheticsLocations } from './dsl/monitor';
|
|
@@ -127,8 +127,8 @@ program
|
|
|
127
127
|
.version(version)
|
|
128
128
|
.description('Run synthetic tests')
|
|
129
129
|
.action(async (cliArgs: CliArgs) => {
|
|
130
|
+
const tearDown = await globalSetup(cliArgs, program.args);
|
|
130
131
|
try {
|
|
131
|
-
await loadTestFiles(cliArgs, program.args);
|
|
132
132
|
const options = normalizeOptions(cliArgs);
|
|
133
133
|
const results = await run(options);
|
|
134
134
|
/**
|
|
@@ -144,6 +144,8 @@ program
|
|
|
144
144
|
} catch (e) {
|
|
145
145
|
console.error(e);
|
|
146
146
|
process.exit(1);
|
|
147
|
+
} finally {
|
|
148
|
+
tearDown();
|
|
147
149
|
}
|
|
148
150
|
});
|
|
149
151
|
|
|
@@ -192,9 +194,11 @@ program
|
|
|
192
194
|
.addOption(params)
|
|
193
195
|
.addOption(playwrightOpts)
|
|
194
196
|
.action(async (cmdOpts: PushOptions) => {
|
|
197
|
+
const workDir = cwd();
|
|
198
|
+
const tearDown = await globalSetup({ inline: false, ...program.opts() }, [
|
|
199
|
+
workDir,
|
|
200
|
+
]);
|
|
195
201
|
try {
|
|
196
|
-
const workDir = cwd();
|
|
197
|
-
await loadTestFiles({ inline: false, ...program.opts() }, [workDir]);
|
|
198
202
|
const settings = await loadSettings();
|
|
199
203
|
const options = normalizeOptions({
|
|
200
204
|
...program.opts(),
|
|
@@ -209,6 +213,8 @@ program
|
|
|
209
213
|
} catch (e) {
|
|
210
214
|
e && console.error(e);
|
|
211
215
|
process.exit(1);
|
|
216
|
+
} finally {
|
|
217
|
+
tearDown();
|
|
212
218
|
}
|
|
213
219
|
});
|
|
214
220
|
|