@elastic/synthetics 1.0.0-beta.4 → 1.0.0-beta.41
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 -3
- package/dist/cli.js +137 -160
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +161 -31
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +3 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -6
- package/dist/config.js.map +1 -1
- package/dist/core/browser-service.d.ts +1 -1
- package/dist/core/browser-service.d.ts.map +1 -1
- package/dist/core/browser-service.js +7 -6
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/expect.d.ts +25 -25
- package/dist/core/expect.d.ts.map +1 -1
- package/dist/core/expect.js.map +1 -1
- package/dist/core/gatherer.d.ts +4 -8
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +53 -15
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +23 -11
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +3 -16
- package/dist/core/logger.js.map +1 -1
- package/dist/core/runner.d.ts +12 -63
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +156 -90
- 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/index.js +5 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/dsl/journey.d.ts +9 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +37 -9
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +83 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +108 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/dsl/step.d.ts +3 -2
- package/dist/dsl/step.d.ts.map +1 -1
- package/dist/dsl/step.js +6 -1
- package/dist/dsl/step.js.map +1 -1
- package/dist/formatter/javascript.d.ts +98 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +298 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/generator/index.d.ts +24 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +241 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/{reporters/reporter.js → generator/utils.d.ts} +5 -3
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +84 -0
- package/dist/generator/utils.js.map +1 -0
- package/dist/helpers.d.ts +28 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +152 -20
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -26
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +34 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +149 -0
- package/dist/loader.js.map +1 -0
- package/dist/locations/index.d.ts +45 -0
- package/dist/locations/index.d.ts.map +1 -0
- package/dist/locations/index.js +83 -0
- package/dist/locations/index.js.map +1 -0
- package/dist/{reporters/reporter.d.ts → locations/public-locations.d.ts} +12 -8
- package/dist/locations/public-locations.d.ts.map +1 -0
- package/dist/locations/public-locations.js +41 -0
- package/dist/locations/public-locations.js.map +1 -0
- package/dist/options.d.ts +41 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +198 -0
- package/dist/options.js.map +1 -0
- package/dist/plugins/browser-console.d.ts +5 -4
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +44 -24
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/index.js +5 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/network.d.ts +20 -33
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +177 -216
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +4 -19
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +6 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +9 -5
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +46 -30
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +6 -6
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +10 -7
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/push/bundler.d.ts +35 -0
- package/dist/push/bundler.d.ts.map +1 -0
- package/dist/push/bundler.js +131 -0
- package/dist/push/bundler.js.map +1 -0
- package/dist/push/index.d.ts +9 -0
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +227 -0
- package/dist/push/index.js.map +1 -0
- 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 +51 -0
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +244 -0
- package/dist/push/monitor.js.map +1 -0
- package/dist/{parse_args.d.ts → push/plugin.d.ts} +9 -6
- package/dist/push/plugin.d.ts.map +1 -0
- package/dist/push/plugin.js +66 -0
- package/dist/push/plugin.js.map +1 -0
- package/dist/push/request.d.ts +45 -0
- package/dist/push/request.d.ts.map +1 -0
- package/dist/push/request.js +109 -0
- package/dist/push/request.js.map +1 -0
- 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.d.ts +14 -6
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +58 -50
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/index.d.ts +18 -8
- package/dist/reporters/index.d.ts.map +1 -1
- package/dist/reporters/index.js.map +1 -1
- package/dist/reporters/json.d.ts +17 -62
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +149 -179
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/junit.d.ts +7 -1
- package/dist/reporters/junit.d.ts.map +1 -1
- package/dist/reporters/junit.js +90 -95
- package/dist/reporters/junit.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +35 -9
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -1
- package/dist/sdk/lh-trace-processor.js +114 -53
- package/dist/sdk/lh-trace-processor.js.map +1 -1
- package/dist/sdk/trace-metrics.d.ts +4 -4
- package/dist/sdk/trace-metrics.d.ts.map +1 -1
- package/dist/sdk/trace-metrics.js +3 -4
- package/dist/sdk/trace-metrics.js.map +1 -1
- package/dist/sdk/trace-processor.d.ts +11 -3
- package/dist/sdk/trace-processor.d.ts.map +1 -1
- package/dist/sdk/trace-processor.js +17 -9
- package/dist/sdk/trace-processor.js.map +1 -1
- package/package.json +39 -24
- package/src/cli.ts +219 -151
- package/src/common_types.ts +193 -31
- package/src/config.ts +3 -6
- package/src/core/expect.ts +58 -24
- package/src/core/gatherer.ts +64 -24
- package/src/core/index.ts +36 -15
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +151 -136
- package/src/core/transform.ts +160 -0
- package/src/dsl/journey.ts +39 -6
- package/src/dsl/monitor.ts +140 -0
- package/src/dsl/step.ts +9 -2
- package/src/formatter/javascript.ts +367 -0
- package/src/generator/index.ts +308 -0
- package/src/generator/utils.ts +84 -0
- package/src/helpers.ts +159 -13
- package/src/index.ts +22 -22
- package/src/loader.ts +167 -0
- package/src/locations/index.ts +95 -0
- package/src/{reporters/reporter.ts → locations/public-locations.ts} +12 -9
- package/src/options.ts +227 -0
- package/src/plugins/browser-console.ts +30 -8
- package/src/plugins/network.ts +208 -267
- package/src/plugins/performance.ts +6 -22
- package/src/plugins/plugin-manager.ts +49 -31
- package/src/plugins/tracing.ts +8 -9
- package/src/push/bundler.ts +112 -0
- package/src/push/index.ts +282 -0
- package/src/push/kibana_api.ts +191 -0
- package/src/push/monitor.ts +276 -0
- package/src/push/plugin.ts +66 -0
- package/src/push/request.ts +141 -0
- package/src/push/utils.ts +77 -0
- package/src/reporters/base.ts +63 -52
- package/src/reporters/index.ts +26 -3
- package/src/reporters/json.ts +183 -202
- package/src/reporters/junit.ts +98 -93
- package/src/sdk/lh-trace-processor.ts +132 -68
- package/src/sdk/trace-metrics.ts +8 -4
- package/src/sdk/trace-processor.ts +28 -13
- package/templates/.github/workflows/run-synthetics.yml +27 -0
- package/templates/README.md +21 -0
- package/templates/journeys/advanced-example-helpers.ts +54 -0
- package/templates/journeys/advanced-example.journey.ts +43 -0
- package/templates/journeys/example.journey.ts +18 -0
- package/templates/lightweight/heartbeat.yml +8 -0
- package/templates/synthetics.config.ts +35 -0
- package/CHANGELOG.md +0 -131
- package/NOTICE.txt +0 -221
- package/dist/parse_args.d.ts.map +0 -1
- package/dist/parse_args.js +0 -95
- package/dist/parse_args.js.map +0 -1
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1888
- package/src/parse_args.ts +0 -135
package/dist/helpers.js
CHANGED
|
@@ -27,15 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.getDurationInUs = exports.CACHE_PATH = exports.formatError = exports.rewriteErrorStack = exports.rewriteErrorMessage = exports.findPWLogsIndexes = exports.totalist = exports.findPkgJsonByTraversing = exports.isFile = exports.isDirectory = exports.isDepInstalled = exports.runParallel = exports.now = exports.getTimestamp = exports.microSecsToSeconds = exports.monotonicTimeInSeconds = exports.generateTempPath = exports.generateUniqueId = exports.symbols = exports.indent = exports.noop = void 0;
|
|
30
|
+
exports.getMonitorManagementURL = exports.removeTrailingSlash = exports.warn = exports.done = exports.error = exports.apiProgress = exports.liveProgress = exports.progress = exports.write = exports.safeNDJSONParse = exports.wrapFnWithLocation = exports.getNetworkConditions = exports.DEFAULT_THROTTLING_OPTIONS = exports.megabitsToBytes = exports.getDurationInUs = exports.CACHE_PATH = exports.SYNTHETICS_PATH = exports.formatError = exports.rewriteErrorStack = exports.rewriteErrorMessage = exports.findPWLogsIndexes = exports.totalist = exports.findPkgJsonByTraversing = exports.isFile = exports.isDirectory = exports.isDepInstalled = exports.runParallel = exports.now = exports.getTimestamp = exports.microSecsToSeconds = exports.monotonicTimeInSeconds = exports.generateTempPath = exports.generateUniqueId = exports.symbols = exports.indent = exports.noop = void 0;
|
|
31
31
|
const colors_1 = require("kleur/colors");
|
|
32
32
|
const os_1 = __importDefault(require("os"));
|
|
33
33
|
const path_1 = require("path");
|
|
34
34
|
const fs_1 = __importDefault(require("fs"));
|
|
35
|
-
const
|
|
35
|
+
const promises_1 = require("fs/promises");
|
|
36
36
|
const perf_hooks_1 = require("perf_hooks");
|
|
37
|
-
const
|
|
38
|
-
const readAsync = util_1.promisify(fs_1.default.readdir);
|
|
37
|
+
const source_map_support_1 = __importDefault(require("source-map-support"));
|
|
39
38
|
const SEPARATOR = '\n';
|
|
40
39
|
function noop() { }
|
|
41
40
|
exports.noop = noop;
|
|
@@ -43,18 +42,24 @@ function indent(lines, tab = ' ') {
|
|
|
43
42
|
return lines.replace(/^/gm, tab);
|
|
44
43
|
}
|
|
45
44
|
exports.indent = indent;
|
|
45
|
+
/**
|
|
46
|
+
* Disable unicode symbols for windows, the underlying
|
|
47
|
+
* FS stream has a known issue in windows
|
|
48
|
+
*/
|
|
49
|
+
const NO_UTF8_SUPPORT = process.platform === 'win32';
|
|
46
50
|
exports.symbols = {
|
|
47
|
-
warning: colors_1.yellow('⚠'),
|
|
48
|
-
skipped: colors_1.cyan('-'),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
warning: (0, colors_1.yellow)(NO_UTF8_SUPPORT ? '!' : '⚠'),
|
|
52
|
+
skipped: (0, colors_1.cyan)('-'),
|
|
53
|
+
progress: (0, colors_1.cyan)('>'),
|
|
54
|
+
succeeded: (0, colors_1.green)(NO_UTF8_SUPPORT ? 'ok' : '✓'),
|
|
55
|
+
failed: (0, colors_1.red)(NO_UTF8_SUPPORT ? 'x' : '✖'),
|
|
51
56
|
};
|
|
52
57
|
function generateUniqueId() {
|
|
53
58
|
return `${Date.now() + Math.floor(Math.random() * 1e13)}`;
|
|
54
59
|
}
|
|
55
60
|
exports.generateUniqueId = generateUniqueId;
|
|
56
61
|
function generateTempPath() {
|
|
57
|
-
return path_1.join(os_1.default.tmpdir(), `synthetics-${generateUniqueId()}`);
|
|
62
|
+
return (0, path_1.join)(os_1.default.tmpdir(), `synthetics-${generateUniqueId()}`);
|
|
58
63
|
}
|
|
59
64
|
exports.generateTempPath = generateTempPath;
|
|
60
65
|
/**
|
|
@@ -127,16 +132,16 @@ exports.isFile = isFile;
|
|
|
127
132
|
* from an NPM project.
|
|
128
133
|
*/
|
|
129
134
|
function findPkgJsonByTraversing(resolvePath, cwd) {
|
|
130
|
-
const packageJSON = path_1.resolve(resolvePath, 'package.json');
|
|
135
|
+
const packageJSON = (0, path_1.resolve)(resolvePath, 'package.json');
|
|
131
136
|
if (isFile(packageJSON)) {
|
|
132
137
|
return packageJSON;
|
|
133
138
|
}
|
|
134
|
-
const parentDirectory = path_1.dirname(resolvePath);
|
|
139
|
+
const parentDirectory = (0, path_1.dirname)(resolvePath);
|
|
135
140
|
/**
|
|
136
141
|
* We are in the system root and package.json does not exist
|
|
137
142
|
*/
|
|
138
143
|
if (resolvePath === parentDirectory) {
|
|
139
|
-
throw colors_1.red(`Could not find package.json file in: "${cwd}"\n` +
|
|
144
|
+
throw (0, colors_1.red)(`Could not find package.json file in: "${cwd}"\n` +
|
|
140
145
|
`It is recommended to run the agent in an NPM project.\n` +
|
|
141
146
|
`You can create one by running "npm init -y" in the project folder.`);
|
|
142
147
|
}
|
|
@@ -151,13 +156,13 @@ exports.findPkgJsonByTraversing = findPkgJsonByTraversing;
|
|
|
151
156
|
* https://github.com/lukeed/totalist/blob/44379974e535afe9c38e8d643dd64c59101a14b9/src/async.js#L8
|
|
152
157
|
*/
|
|
153
158
|
async function totalist(dir, callback, pre = '') {
|
|
154
|
-
dir = path_1.resolve('.', dir);
|
|
155
|
-
await
|
|
159
|
+
dir = (0, path_1.resolve)('.', dir);
|
|
160
|
+
await (0, promises_1.readdir)(dir).then(arr => {
|
|
156
161
|
return Promise.all(arr.map(str => {
|
|
157
|
-
const abs = path_1.join(dir, str);
|
|
158
|
-
return
|
|
159
|
-
? totalist(abs, callback, path_1.join(pre, str))
|
|
160
|
-
: callback(path_1.join(pre, str), abs));
|
|
162
|
+
const abs = (0, path_1.join)(dir, str);
|
|
163
|
+
return (0, promises_1.lstat)(abs).then(stats => stats.isDirectory()
|
|
164
|
+
? totalist(abs, callback, (0, path_1.join)(pre, str))
|
|
165
|
+
: callback((0, path_1.join)(pre, str), abs));
|
|
161
166
|
}));
|
|
162
167
|
});
|
|
163
168
|
}
|
|
@@ -212,10 +217,20 @@ function rewriteErrorStack(stack, indexes) {
|
|
|
212
217
|
return stack;
|
|
213
218
|
}
|
|
214
219
|
exports.rewriteErrorStack = rewriteErrorStack;
|
|
220
|
+
// formatError prefers receiving proper Errors, but since at runtime
|
|
221
|
+
// non Error exceptions can be thrown, it tolerates though. The
|
|
222
|
+
// redundant type Error | any expresses that.
|
|
215
223
|
function formatError(error) {
|
|
216
|
-
if (
|
|
224
|
+
if (error === undefined || error === null) {
|
|
217
225
|
return;
|
|
218
226
|
}
|
|
227
|
+
if (!(error instanceof Error)) {
|
|
228
|
+
return {
|
|
229
|
+
message: `Error "${error}" received, with type "${typeof error}". (Do not throw exceptions without using \`new Error("my message")\`)`,
|
|
230
|
+
name: '',
|
|
231
|
+
stack: '',
|
|
232
|
+
};
|
|
233
|
+
}
|
|
219
234
|
const { name, message, stack } = error;
|
|
220
235
|
const indexes = findPWLogsIndexes(message);
|
|
221
236
|
return {
|
|
@@ -226,14 +241,131 @@ function formatError(error) {
|
|
|
226
241
|
}
|
|
227
242
|
exports.formatError = formatError;
|
|
228
243
|
const cwd = process.cwd();
|
|
244
|
+
/**
|
|
245
|
+
* All the settings that are related to the Synthetics is stored
|
|
246
|
+
* under this directory
|
|
247
|
+
* Examples: Screenshots, Project setup
|
|
248
|
+
*/
|
|
249
|
+
exports.SYNTHETICS_PATH = (0, path_1.join)(cwd, '.synthetics');
|
|
229
250
|
/**
|
|
230
251
|
* Synthetics cache path that is based on the process id to make sure
|
|
231
252
|
* each process does not modify the caching layer used by other process
|
|
232
253
|
* once we move to executing journeys in parallel
|
|
233
254
|
*/
|
|
234
|
-
exports.CACHE_PATH = path_1.join(
|
|
255
|
+
exports.CACHE_PATH = (0, path_1.join)(exports.SYNTHETICS_PATH, process.pid.toString());
|
|
235
256
|
function getDurationInUs(duration) {
|
|
236
257
|
return Math.trunc(duration * 1e6);
|
|
237
258
|
}
|
|
238
259
|
exports.getDurationInUs = getDurationInUs;
|
|
260
|
+
function megabitsToBytes(megabytes) {
|
|
261
|
+
return (megabytes * 1024 * 1024) / 8;
|
|
262
|
+
}
|
|
263
|
+
exports.megabitsToBytes = megabitsToBytes;
|
|
264
|
+
exports.DEFAULT_THROTTLING_OPTIONS = {
|
|
265
|
+
download: 5,
|
|
266
|
+
upload: 3,
|
|
267
|
+
latency: 20,
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Transforms the CLI throttling arguments in to format
|
|
271
|
+
* expected by Chrome devtools protocol NetworkConditions
|
|
272
|
+
*/
|
|
273
|
+
function getNetworkConditions(throttlingOpts) {
|
|
274
|
+
return {
|
|
275
|
+
downloadThroughput: megabitsToBytes(throttlingOpts.download),
|
|
276
|
+
uploadThroughput: megabitsToBytes(throttlingOpts.upload),
|
|
277
|
+
latency: throttlingOpts.latency,
|
|
278
|
+
offline: false,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
exports.getNetworkConditions = getNetworkConditions;
|
|
282
|
+
const dstackTraceLimit = 10;
|
|
283
|
+
// Uses the V8 Stacktrace API to get the function location
|
|
284
|
+
// information - https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
285
|
+
function wrapFnWithLocation(func) {
|
|
286
|
+
return (...args) => {
|
|
287
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
288
|
+
Error.prepareStackTrace = (_, stackFrames) => {
|
|
289
|
+
// Deafult CallSite would not map to the original transpiled source
|
|
290
|
+
// correctly, So we use source-map-support to map the CallSite to the
|
|
291
|
+
// original source from our cached source map
|
|
292
|
+
const frame = source_map_support_1.default.wrapCallSite(stackFrames[1]);
|
|
293
|
+
return {
|
|
294
|
+
file: frame.getFileName(),
|
|
295
|
+
line: frame.getLineNumber(),
|
|
296
|
+
column: frame.getColumnNumber(),
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
Error.stackTraceLimit = 2;
|
|
300
|
+
const obj = {};
|
|
301
|
+
Error.captureStackTrace(obj);
|
|
302
|
+
const location = obj.stack;
|
|
303
|
+
Error.stackTraceLimit = dstackTraceLimit;
|
|
304
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
305
|
+
return func(location, ...args);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
exports.wrapFnWithLocation = wrapFnWithLocation;
|
|
309
|
+
// Safely parse ND JSON (Newline delimitted JSON) chunks
|
|
310
|
+
function safeNDJSONParse(data) {
|
|
311
|
+
// data may not be at proper newline boundaries, so we make sure everything is split
|
|
312
|
+
// on proper newlines
|
|
313
|
+
const chunks = Array.isArray(data) ? data : [data];
|
|
314
|
+
const lines = chunks.join('\n').split(/\r?\n/);
|
|
315
|
+
return lines
|
|
316
|
+
.filter(l => l.match(/\S/)) // remove blank lines
|
|
317
|
+
.map(line => {
|
|
318
|
+
try {
|
|
319
|
+
return JSON.parse(line);
|
|
320
|
+
}
|
|
321
|
+
catch (e) {
|
|
322
|
+
throw `Error ${e} could not parse data '${line}'`;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
exports.safeNDJSONParse = safeNDJSONParse;
|
|
327
|
+
// Console helpers
|
|
328
|
+
function write(message, live) {
|
|
329
|
+
process.stderr.write(message + (live ? '\r' : '\n'));
|
|
330
|
+
}
|
|
331
|
+
exports.write = write;
|
|
332
|
+
function progress(message) {
|
|
333
|
+
write((0, colors_1.cyan)((0, colors_1.bold)(`${exports.symbols.progress} ${message}`)));
|
|
334
|
+
}
|
|
335
|
+
exports.progress = progress;
|
|
336
|
+
async function liveProgress(promise, message) {
|
|
337
|
+
const start = now();
|
|
338
|
+
const interval = setInterval(() => {
|
|
339
|
+
apiProgress(`${message} (${Math.trunc(now() - start)}ms)`, true);
|
|
340
|
+
}, 500);
|
|
341
|
+
promise.finally(() => clearInterval(interval));
|
|
342
|
+
const result = await promise;
|
|
343
|
+
apiProgress(`${message} (${Math.trunc(now() - start)}ms)`);
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
exports.liveProgress = liveProgress;
|
|
347
|
+
function apiProgress(message, live = false) {
|
|
348
|
+
write((0, colors_1.grey)(`> ${message}`), live);
|
|
349
|
+
}
|
|
350
|
+
exports.apiProgress = apiProgress;
|
|
351
|
+
function error(message) {
|
|
352
|
+
write((0, colors_1.red)(message));
|
|
353
|
+
}
|
|
354
|
+
exports.error = error;
|
|
355
|
+
function done(message) {
|
|
356
|
+
write((0, colors_1.bold)((0, colors_1.green)(`${exports.symbols['succeeded']} ${message}`)));
|
|
357
|
+
}
|
|
358
|
+
exports.done = done;
|
|
359
|
+
function warn(message) {
|
|
360
|
+
write((0, colors_1.bold)((0, colors_1.yellow)(`${exports.symbols['warning']} ${message}`)));
|
|
361
|
+
}
|
|
362
|
+
exports.warn = warn;
|
|
363
|
+
function removeTrailingSlash(url) {
|
|
364
|
+
return url.replace(/\/+$/, '');
|
|
365
|
+
}
|
|
366
|
+
exports.removeTrailingSlash = removeTrailingSlash;
|
|
367
|
+
function getMonitorManagementURL(url) {
|
|
368
|
+
return removeTrailingSlash(url) + '/app/uptime/manage-monitors/all';
|
|
369
|
+
}
|
|
370
|
+
exports.getMonitorManagementURL = getMonitorManagementURL;
|
|
239
371
|
//# sourceMappingURL=helpers.js.map
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,yCAAoE;AACpE,4CAAoB;AACpB,+BAA8C;AAC9C,4CAAoB;AACpB,0CAA6C;AAC7C,2CAAyC;AACzC,4EAAkD;AASlD,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,SAAgB,IAAI,KAAI,CAAC;AAAzB,oBAAyB;AAEzB,SAAgB,MAAM,CAAC,KAAa,EAAE,GAAG,GAAG,KAAK;IAC/C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC;AAFD,wBAEC;AAED;;;GAGG;AACH,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACxC,QAAA,OAAO,GAAG;IACrB,OAAO,EAAE,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,OAAO,EAAE,IAAA,aAAI,EAAC,GAAG,CAAC;IAClB,QAAQ,EAAE,IAAA,aAAI,EAAC,GAAG,CAAC;IACnB,S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22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import { RunOptions } from './
|
|
25
|
+
import { RunOptions } from './common_types';
|
|
26
26
|
export declare function run(options: RunOptions): Promise<{
|
|
27
|
-
[x: string]:
|
|
28
|
-
status: import("./common_types").StatusValue;
|
|
29
|
-
error?: Error;
|
|
30
|
-
};
|
|
27
|
+
[x: string]: import("./common_types").JourneyResult;
|
|
31
28
|
}>;
|
|
32
29
|
/**
|
|
33
30
|
* Export all core module functions
|
|
34
31
|
*/
|
|
35
|
-
export {
|
|
32
|
+
export { journey, step, monitor, beforeAll, afterAll, before, after, } from './core';
|
|
36
33
|
export { expect } from './core/expect';
|
|
37
34
|
/**
|
|
38
35
|
* Export all the driver related types to be consumed
|
|
39
36
|
* and used by suites
|
|
40
37
|
*/
|
|
41
|
-
export type { Page, ChromiumBrowser, ChromiumBrowserContext, CDPSession, } from 'playwright-chromium';
|
|
38
|
+
export type { Page, ChromiumBrowser, ChromiumBrowserContext, CDPSession, APIRequestContext, } from 'playwright-chromium';
|
|
42
39
|
/**
|
|
43
40
|
* Export the types necessary to write custom reporters
|
|
44
41
|
*/
|
|
45
42
|
export type { default as Runner } from './core/runner';
|
|
46
43
|
export type { Reporter, ReporterOptions } from './reporters';
|
|
44
|
+
export type { SyntheticsConfig } from './common_types';
|
|
45
|
+
export type { Action, ActionInContext, Signal, Step, Steps, actionTitle, } from './formatter/javascript';
|
|
47
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU;;GAE5C;AAED;;GAEG;AACH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,MAAM,EACN,KAAK,GACN,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC;;;GAGG;AACH,YAAY,EACV,IAAI,EACJ,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,YAAY,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,MAAM,EACN,eAAe,EACf,MAAM,EACN,IAAI,EACJ,KAAK,EACL,WAAW,GACZ,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,43 +23,22 @@
|
|
|
23
23
|
* THE SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.expect = exports.after = exports.before = exports.
|
|
27
|
+
exports.expect = exports.after = exports.before = exports.afterAll = exports.beforeAll = exports.monitor = exports.step = exports.journey = exports.run = void 0;
|
|
31
28
|
const core_1 = require("./core");
|
|
32
|
-
const logger_1 = require("./core/logger");
|
|
33
|
-
const source_map_support_1 = __importDefault(require("source-map-support"));
|
|
34
29
|
async function run(options) {
|
|
35
|
-
|
|
36
|
-
* Install source map support
|
|
37
|
-
*/
|
|
38
|
-
source_map_support_1.default.install({
|
|
39
|
-
environment: 'node',
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* set up logger with appropriate file descriptor
|
|
43
|
-
* to capture all the DEBUG logs when run through heartbeat
|
|
44
|
-
*/
|
|
45
|
-
logger_1.setLogger(options.outfd);
|
|
46
|
-
try {
|
|
47
|
-
return await core_1.runner.run(options);
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
console.error('Failed to run the test', e);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
30
|
+
return core_1.runner.run(options);
|
|
53
31
|
}
|
|
54
32
|
exports.run = run;
|
|
55
33
|
/**
|
|
56
34
|
* Export all core module functions
|
|
57
35
|
*/
|
|
58
36
|
var core_2 = require("./core");
|
|
59
|
-
Object.defineProperty(exports, "beforeAll", { enumerable: true, get: function () { return core_2.beforeAll; } });
|
|
60
|
-
Object.defineProperty(exports, "afterAll", { enumerable: true, get: function () { return core_2.afterAll; } });
|
|
61
37
|
Object.defineProperty(exports, "journey", { enumerable: true, get: function () { return core_2.journey; } });
|
|
62
38
|
Object.defineProperty(exports, "step", { enumerable: true, get: function () { return core_2.step; } });
|
|
39
|
+
Object.defineProperty(exports, "monitor", { enumerable: true, get: function () { return core_2.monitor; } });
|
|
40
|
+
Object.defineProperty(exports, "beforeAll", { enumerable: true, get: function () { return core_2.beforeAll; } });
|
|
41
|
+
Object.defineProperty(exports, "afterAll", { enumerable: true, get: function () { return core_2.afterAll; } });
|
|
63
42
|
Object.defineProperty(exports, "before", { enumerable: true, get: function () { return core_2.before; } });
|
|
64
43
|
Object.defineProperty(exports, "after", { enumerable: true, get: function () { return core_2.after; } });
|
|
65
44
|
var expect_1 = require("./core/expect");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,iCAAgC;AAGzB,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,OAAO,aAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAFD,kBAEC;AAED;;GAEG;AACH,+BAQgB;AAPd,+FAAA,OAAO,OAAA;AACP,4FAAA,IAAI,OAAA;AACJ,+FAAA,OAAO,OAAA;AACP,iGAAA,SAAS,OAAA;AACT,gGAAA,QAAQ,OAAA;AACR,8FAAA,MAAM,OAAA;AACN,6FAAA,KAAK,OAAA;AAEP,wCAAuC;AAA9B,gGAAA,MAAM,OAAA"}
|
package/dist/loader.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
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 { CliArgs } from './common_types';
|
|
26
|
+
/**
|
|
27
|
+
* Perform global setup process required for running the test suites
|
|
28
|
+
* and also for bundling the monitors. The process includes
|
|
29
|
+
* - Transpiling the TS/JS test files
|
|
30
|
+
* - Loading these files for running test suites
|
|
31
|
+
*/
|
|
32
|
+
export declare function globalSetup(options: CliArgs, args: string[]): Promise<() => void>;
|
|
33
|
+
export declare function loadTestFiles(options: CliArgs, args: string[]): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAczC;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAMjE;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,iBA0BnE"}
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
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.loadTestFiles = exports.globalSetup = void 0;
|
|
28
|
+
const process_1 = require("process");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
const core_1 = require("./core");
|
|
31
|
+
const logger_1 = require("./core/logger");
|
|
32
|
+
const expect_1 = require("./core/expect");
|
|
33
|
+
const helpers_1 = require("./helpers");
|
|
34
|
+
const transform_1 = require("./core/transform");
|
|
35
|
+
const resolvedCwd = (0, process_1.cwd)();
|
|
36
|
+
/**
|
|
37
|
+
* Perform global setup process required for running the test suites
|
|
38
|
+
* and also for bundling the monitors. The process includes
|
|
39
|
+
* - Transpiling the TS/JS test files
|
|
40
|
+
* - Loading these files for running test suites
|
|
41
|
+
*/
|
|
42
|
+
async function globalSetup(options, args) {
|
|
43
|
+
const revert = (0, transform_1.installTransform)();
|
|
44
|
+
await loadTestFiles(options, args);
|
|
45
|
+
return () => {
|
|
46
|
+
revert();
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.globalSetup = globalSetup;
|
|
50
|
+
async function loadTestFiles(options, args) {
|
|
51
|
+
/**
|
|
52
|
+
* Preload modules before running the tests
|
|
53
|
+
*/
|
|
54
|
+
const modules = [].concat(options.require || []).filter(Boolean);
|
|
55
|
+
for (const name of modules) {
|
|
56
|
+
if ((0, helpers_1.isDepInstalled)(name)) {
|
|
57
|
+
require(name);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error(`cannot find module '${name}'`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (options.inline) {
|
|
64
|
+
const source = await readStdin();
|
|
65
|
+
loadInlineScript(source);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Handle piped files by reading the STDIN
|
|
70
|
+
* ex: ls example/suites/*.js | npx @elastic/synthetics
|
|
71
|
+
*/
|
|
72
|
+
const files = args.length > 0 ? args : (await readStdin()).split('\n').filter(Boolean);
|
|
73
|
+
const suites = await prepareSuites(files, options.pattern);
|
|
74
|
+
requireSuites(suites);
|
|
75
|
+
}
|
|
76
|
+
exports.loadTestFiles = loadTestFiles;
|
|
77
|
+
const loadInlineScript = source => {
|
|
78
|
+
const scriptFn = new Function('step', 'page', 'context', 'browser', 'params', 'expect', 'request', source);
|
|
79
|
+
(0, core_1.journey)('inline', ({ page, context, browser, params, request }) => {
|
|
80
|
+
scriptFn.apply(null, [
|
|
81
|
+
core_1.step,
|
|
82
|
+
page,
|
|
83
|
+
context,
|
|
84
|
+
browser,
|
|
85
|
+
params,
|
|
86
|
+
expect_1.expect,
|
|
87
|
+
request,
|
|
88
|
+
]);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Read the input from STDIN and run it as inline journey
|
|
93
|
+
*/
|
|
94
|
+
async function readStdin() {
|
|
95
|
+
const chunks = [];
|
|
96
|
+
process_1.stdin.resume();
|
|
97
|
+
process_1.stdin.setEncoding('utf-8');
|
|
98
|
+
for await (const chunk of process_1.stdin) {
|
|
99
|
+
chunks.push(chunk);
|
|
100
|
+
}
|
|
101
|
+
return chunks.join();
|
|
102
|
+
}
|
|
103
|
+
function requireSuites(suites) {
|
|
104
|
+
for (const suite of suites) {
|
|
105
|
+
require(suite);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Handle both directory and files that are passed through TTY
|
|
110
|
+
* and add them to suites
|
|
111
|
+
*/
|
|
112
|
+
async function prepareSuites(inputs, filePattern) {
|
|
113
|
+
const suites = new Set();
|
|
114
|
+
const addSuite = absPath => {
|
|
115
|
+
(0, logger_1.log)(`Processing file: ${absPath}`);
|
|
116
|
+
suites.add(require.resolve(absPath));
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Match all files inside the directory with the
|
|
120
|
+
* .journey.{mjs|cjs|js|ts) extensions
|
|
121
|
+
*/
|
|
122
|
+
const pattern = filePattern
|
|
123
|
+
? new RegExp(filePattern, 'i')
|
|
124
|
+
: /.+\.journey\.([mc]js|[jt]s?)$/;
|
|
125
|
+
/**
|
|
126
|
+
* Ignore node_modules by default when running suites
|
|
127
|
+
*/
|
|
128
|
+
const ignored = /node_modules/i;
|
|
129
|
+
for (const input of inputs) {
|
|
130
|
+
const absPath = (0, path_1.resolve)(resolvedCwd, input);
|
|
131
|
+
/**
|
|
132
|
+
* Validate for package.json file before running
|
|
133
|
+
* the suites
|
|
134
|
+
*/
|
|
135
|
+
(0, helpers_1.findPkgJsonByTraversing)(absPath, resolvedCwd);
|
|
136
|
+
if ((0, helpers_1.isDirectory)(absPath)) {
|
|
137
|
+
await (0, helpers_1.totalist)(absPath, (rel, abs) => {
|
|
138
|
+
if (pattern.test(rel) && !ignored.test(rel)) {
|
|
139
|
+
addSuite(abs);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
addSuite(absPath);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return suites.values();
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,qCAAqC;AACrC,+BAA+B;AAE/B,iCAAuC;AACvC,0CAAoC;AACpC,0CAAuC;AACvC,uCAKmB;AACnB,gDAAoD;AAEpD,MAAM,WAAW,GAAG,IAAA,aAAG,GAAE,CAAC;AAE1B;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,OAAgB,EAAE,IAAc;IAChE,MAAM,MAAM,GAAG,IAAA,4BAAgB,GAAE,CAAC;IAClC,MAAM,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,GAAG,EAAE;QACV,MAAM,EAAE,CAAC;IACX,CAAC,CAAC;AACJ,CAAC;AAND,kCAMC;AAEM,KAAK,UAAU,aAAa,CAAC,OAAgB,EAAE,IAAc;IAClE;;OAEG;IACH,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjE,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;QAC1B,IAAI,IAAA,wBAAc,EAAC,IAAI,CAAC,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC,CAAC;SACf;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,GAAG,CAAC,CAAC;SACjD;KACF;IAED,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,gBAAgB,CAAC,MAAM,CAAC,CAAC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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
|
+
export declare type LocationCmdOptions = {
|
|
26
|
+
auth: string;
|
|
27
|
+
url: string;
|
|
28
|
+
};
|
|
29
|
+
declare type LocationMetadata = {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
isServiceManaged: boolean;
|
|
33
|
+
};
|
|
34
|
+
export declare type LocationAPIResponse = {
|
|
35
|
+
locations: Array<LocationMetadata>;
|
|
36
|
+
};
|
|
37
|
+
export declare function getLocations(options: LocationCmdOptions): Promise<LocationMetadata[]>;
|
|
38
|
+
export declare function formatLocations(locations: Array<LocationMetadata>): string[];
|
|
39
|
+
export declare function groupLocations(locations: Array<string>): {
|
|
40
|
+
locations: any[];
|
|
41
|
+
privateLocations: any[];
|
|
42
|
+
};
|
|
43
|
+
export declare function renderLocations(locations: Array<string>): void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACpC,CAAC;AAIF,wBAAsB,YAAY,CAAC,OAAO,EAAE,kBAAkB,+BAO7D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,YAajE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;;;EAUtD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,QAYvD"}
|