@datadog/datadog-ci-plugin-synthetics 5.12.1 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +2392 -0
- package/dist/bundle.js +144530 -0
- package/dist/bundle.js.LEGAL.txt +2412 -0
- package/dist/bundle.js.map +1 -0
- package/dist/commands/deploy-tests.js +2 -125
- package/dist/commands/import-tests.js +2 -118
- package/dist/commands/run-tests.js +2 -319
- package/dist/commands/upload-application.js +2 -138
- package/package.json +19 -19
- package/dist/api.d.ts +0 -52
- package/dist/api.js +0 -333
- package/dist/api.js.map +0 -1
- package/dist/batch.d.ts +0 -9
- package/dist/batch.js +0 -325
- package/dist/batch.js.map +0 -1
- package/dist/build-and-test.d.ts +0 -25
- package/dist/build-and-test.js +0 -196
- package/dist/build-and-test.js.map +0 -1
- package/dist/commands/deploy-tests.d.ts +0 -19
- package/dist/commands/deploy-tests.js.map +0 -1
- package/dist/commands/import-tests.d.ts +0 -19
- package/dist/commands/import-tests.js.map +0 -1
- package/dist/commands/run-tests.d.ts +0 -19
- package/dist/commands/run-tests.js.map +0 -1
- package/dist/commands/upload-application.d.ts +0 -18
- package/dist/commands/upload-application.js.map +0 -1
- package/dist/deploy-tests-lib.d.ts +0 -2
- package/dist/deploy-tests-lib.js +0 -96
- package/dist/deploy-tests-lib.js.map +0 -1
- package/dist/errors.d.ts +0 -19
- package/dist/errors.js +0 -31
- package/dist/errors.js.map +0 -1
- package/dist/import-tests-lib.d.ts +0 -2
- package/dist/import-tests-lib.js +0 -71
- package/dist/import-tests-lib.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -46
- package/dist/index.js.map +0 -1
- package/dist/interfaces.d.ts +0 -759
- package/dist/interfaces.js +0 -27
- package/dist/interfaces.js.map +0 -1
- package/dist/local-test-definition.d.ts +0 -2
- package/dist/local-test-definition.js +0 -16
- package/dist/local-test-definition.js.map +0 -1
- package/dist/mobile.d.ts +0 -28
- package/dist/mobile.js +0 -275
- package/dist/mobile.js.map +0 -1
- package/dist/multilocator.d.ts +0 -2
- package/dist/multilocator.js +0 -88
- package/dist/multilocator.js.map +0 -1
- package/dist/reporters/constants.d.ts +0 -6
- package/dist/reporters/constants.js +0 -14
- package/dist/reporters/constants.js.map +0 -1
- package/dist/reporters/default.d.ts +0 -33
- package/dist/reporters/default.js +0 -461
- package/dist/reporters/default.js.map +0 -1
- package/dist/reporters/junit.d.ts +0 -100
- package/dist/reporters/junit.js +0 -425
- package/dist/reporters/junit.js.map +0 -1
- package/dist/reporters/mobile/app-upload.d.ts +0 -14
- package/dist/reporters/mobile/app-upload.js +0 -54
- package/dist/reporters/mobile/app-upload.js.map +0 -1
- package/dist/run-tests-lib.d.ts +0 -28
- package/dist/run-tests-lib.js +0 -281
- package/dist/run-tests-lib.js.map +0 -1
- package/dist/test.d.ts +0 -29
- package/dist/test.js +0 -200
- package/dist/test.js.map +0 -1
- package/dist/tunnel/crypto.d.ts +0 -6
- package/dist/tunnel/crypto.js +0 -48
- package/dist/tunnel/crypto.js.map +0 -1
- package/dist/tunnel/index.d.ts +0 -1
- package/dist/tunnel/index.js +0 -6
- package/dist/tunnel/index.js.map +0 -1
- package/dist/tunnel/tunnel.d.ts +0 -49
- package/dist/tunnel/tunnel.js +0 -329
- package/dist/tunnel/tunnel.js.map +0 -1
- package/dist/tunnel/websocket.d.ts +0 -39
- package/dist/tunnel/websocket.js +0 -154
- package/dist/tunnel/websocket.js.map +0 -1
- package/dist/utils/internal.d.ts +0 -58
- package/dist/utils/internal.js +0 -317
- package/dist/utils/internal.js.map +0 -1
- package/dist/utils/public.d.ts +0 -81
- package/dist/utils/public.js +0 -524
- package/dist/utils/public.js.map +0 -1
|
@@ -1,125 +1,2 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PluginCommand = void 0;
|
|
16
|
-
const deploy_tests_1 = require("@datadog/datadog-ci-base/commands/synthetics/deploy-tests");
|
|
17
|
-
const constants_1 = require("@datadog/datadog-ci-base/constants");
|
|
18
|
-
const api_1 = require("@datadog/datadog-ci-base/helpers/api");
|
|
19
|
-
const env_1 = require("@datadog/datadog-ci-base/helpers/env");
|
|
20
|
-
const fips_1 = require("@datadog/datadog-ci-base/helpers/fips");
|
|
21
|
-
const logger_1 = require("@datadog/datadog-ci-base/helpers/logger");
|
|
22
|
-
const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
|
|
23
|
-
const deep_extend_1 = __importDefault(require("deep-extend"));
|
|
24
|
-
const deploy_tests_lib_1 = require("../deploy-tests-lib");
|
|
25
|
-
const errors_1 = require("../errors");
|
|
26
|
-
const default_1 = require("../reporters/default");
|
|
27
|
-
const internal_1 = require("../utils/internal");
|
|
28
|
-
const public_1 = require("../utils/public");
|
|
29
|
-
class PluginCommand extends deploy_tests_1.SyntheticsDeployTestsCommand {
|
|
30
|
-
constructor() {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
super(...arguments);
|
|
33
|
-
this.config = PluginCommand.getDefaultConfig();
|
|
34
|
-
this.fipsConfig = {
|
|
35
|
-
fips: (_a = (0, env_1.toBoolean)(process.env[constants_1.FIPS_ENV_VAR])) !== null && _a !== void 0 ? _a : false,
|
|
36
|
-
fipsIgnoreError: (_b = (0, env_1.toBoolean)(process.env[constants_1.FIPS_IGNORE_ERROR_ENV_VAR])) !== null && _b !== void 0 ? _b : false,
|
|
37
|
-
};
|
|
38
|
-
this.logger = new logger_1.Logger((s) => {
|
|
39
|
-
this.context.stdout.write(s);
|
|
40
|
-
}, logger_1.LogLevel.INFO);
|
|
41
|
-
}
|
|
42
|
-
static getDefaultConfig() {
|
|
43
|
-
return Object.assign(Object.assign({}, (0, internal_1.getDefaultConfig)()), { files: [], publicIds: [], subdomain: 'app', excludeFields: ['config'] });
|
|
44
|
-
}
|
|
45
|
-
setup() {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
(0, fips_1.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
|
|
48
|
-
// Bootstrap reporter
|
|
49
|
-
this.reporter = (0, public_1.getReporter)([new default_1.DefaultReporter(this)]);
|
|
50
|
-
// Load config
|
|
51
|
-
yield this.resolveConfig();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
resolveConfig() {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
// Defaults < file < ENV < CLI
|
|
58
|
-
// Override with config file variables (e.g. datadog-ci.json)
|
|
59
|
-
try {
|
|
60
|
-
// Override Config Path with ENV variables
|
|
61
|
-
const overrideConfigPath = (_b = (_a = this.configPath) !== null && _a !== void 0 ? _a : process.env.DATADOG_SYNTHETICS_CONFIG_PATH) !== null && _b !== void 0 ? _b : 'datadog-ci.json';
|
|
62
|
-
this.config = yield (0, utils_1.resolveConfigFromFile)(this.config, {
|
|
63
|
-
configPath: overrideConfigPath,
|
|
64
|
-
defaultConfigPaths: [this.config.configPath],
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (this.configPath) {
|
|
69
|
-
throw new errors_1.CiError('INVALID_CONFIG', error.message);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Override with ENV variables
|
|
73
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromEnv()));
|
|
74
|
-
// Override with CLI parameters
|
|
75
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromCli()));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
execute() {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
// populate the config
|
|
81
|
-
yield this.setup();
|
|
82
|
-
try {
|
|
83
|
-
yield (0, deploy_tests_lib_1.deployTests)(this.reporter, this.config);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
this.logger.error(`Error: ${error.message}`);
|
|
87
|
-
return 1;
|
|
88
|
-
}
|
|
89
|
-
return 0;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
resolveConfigFromEnv() {
|
|
93
|
-
var _a, _b, _c;
|
|
94
|
-
return {
|
|
95
|
-
// ...super.resolveConfigFromEnv(),
|
|
96
|
-
// BASE COMMAND START
|
|
97
|
-
apiKey: process.env.DATADOG_API_KEY || process.env.DD_API_KEY,
|
|
98
|
-
appKey: process.env.DATADOG_APP_KEY || process.env.DD_APP_KEY,
|
|
99
|
-
configPath: process.env.DATADOG_SYNTHETICS_CONFIG_PATH,
|
|
100
|
-
datadogSite: (0, api_1.getDatadogSiteFromEnv)(),
|
|
101
|
-
// BASE COMMAND END
|
|
102
|
-
files: (_a = process.env.DATADOG_SYNTHETICS_FILES) === null || _a === void 0 ? void 0 : _a.split(';'),
|
|
103
|
-
publicIds: (_b = process.env.DATADOG_SYNTHETICS_PUBLIC_IDS) === null || _b === void 0 ? void 0 : _b.split(';'),
|
|
104
|
-
subdomain: process.env.DATADOG_SUBDOMAIN,
|
|
105
|
-
excludeFields: (_c = process.env.DATADOG_SYNTHETICS_EXCLUDE_FIELDS) === null || _c === void 0 ? void 0 : _c.split(';'),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
resolveConfigFromCli() {
|
|
109
|
-
return {
|
|
110
|
-
// ...super.resolveConfigFromCli(),
|
|
111
|
-
// BASE COMMAND START
|
|
112
|
-
apiKey: this.apiKey,
|
|
113
|
-
appKey: this.appKey,
|
|
114
|
-
configPath: this.configPath,
|
|
115
|
-
datadogSite: this.datadogSite,
|
|
116
|
-
// BASE COMMAND END
|
|
117
|
-
files: this.files,
|
|
118
|
-
publicIds: this.publicIds,
|
|
119
|
-
subdomain: this.subdomain,
|
|
120
|
-
excludeFields: this.excludeFields,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.PluginCommand = PluginCommand;
|
|
125
|
-
//# sourceMappingURL=deploy-tests.js.map
|
|
1
|
+
"use strict"
|
|
2
|
+
module.exports = require("../bundle.js").commands["deploy-tests"]
|
|
@@ -1,118 +1,2 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PluginCommand = void 0;
|
|
16
|
-
const import_tests_1 = require("@datadog/datadog-ci-base/commands/synthetics/import-tests");
|
|
17
|
-
const constants_1 = require("@datadog/datadog-ci-base/constants");
|
|
18
|
-
const api_1 = require("@datadog/datadog-ci-base/helpers/api");
|
|
19
|
-
const env_1 = require("@datadog/datadog-ci-base/helpers/env");
|
|
20
|
-
const fips_1 = require("@datadog/datadog-ci-base/helpers/fips");
|
|
21
|
-
const logger_1 = require("@datadog/datadog-ci-base/helpers/logger");
|
|
22
|
-
const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
|
|
23
|
-
const deep_extend_1 = __importDefault(require("deep-extend"));
|
|
24
|
-
const errors_1 = require("../errors");
|
|
25
|
-
const import_tests_lib_1 = require("../import-tests-lib");
|
|
26
|
-
const internal_1 = require("../utils/internal");
|
|
27
|
-
class PluginCommand extends import_tests_1.SyntheticsImportTestsCommand {
|
|
28
|
-
constructor() {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
super(...arguments);
|
|
31
|
-
this.config = PluginCommand.getDefaultConfig();
|
|
32
|
-
this.fipsConfig = {
|
|
33
|
-
fips: (_a = (0, env_1.toBoolean)(process.env[constants_1.FIPS_ENV_VAR])) !== null && _a !== void 0 ? _a : false,
|
|
34
|
-
fipsIgnoreError: (_b = (0, env_1.toBoolean)(process.env[constants_1.FIPS_IGNORE_ERROR_ENV_VAR])) !== null && _b !== void 0 ? _b : false,
|
|
35
|
-
};
|
|
36
|
-
this.logger = new logger_1.Logger((s) => {
|
|
37
|
-
this.context.stdout.write(s);
|
|
38
|
-
}, logger_1.LogLevel.INFO);
|
|
39
|
-
}
|
|
40
|
-
static getDefaultConfig() {
|
|
41
|
-
return Object.assign(Object.assign({}, (0, internal_1.getDefaultConfig)()), { files: [], publicIds: [], testSearchQuery: '' });
|
|
42
|
-
}
|
|
43
|
-
setup() {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
(0, fips_1.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
|
|
46
|
-
// Load config
|
|
47
|
-
yield this.resolveConfig();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
resolveConfig() {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
// Defaults < file < ENV < CLI
|
|
54
|
-
// Override with config file variables (e.g. datadog-ci.json)
|
|
55
|
-
try {
|
|
56
|
-
// Override Config Path with ENV variables
|
|
57
|
-
const overrideConfigPath = (_b = (_a = this.configPath) !== null && _a !== void 0 ? _a : process.env.DATADOG_SYNTHETICS_CONFIG_PATH) !== null && _b !== void 0 ? _b : 'datadog-ci.json';
|
|
58
|
-
this.config = yield (0, utils_1.resolveConfigFromFile)(this.config, {
|
|
59
|
-
configPath: overrideConfigPath,
|
|
60
|
-
defaultConfigPaths: [this.config.configPath],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
if (this.configPath) {
|
|
65
|
-
throw new errors_1.CiError('INVALID_CONFIG', error.message);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Override with ENV variables
|
|
69
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromEnv()));
|
|
70
|
-
// Override with CLI parameters
|
|
71
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromCli()));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
execute() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
yield this.setup();
|
|
77
|
-
try {
|
|
78
|
-
yield (0, import_tests_lib_1.importTests)(this.reporter, this.config);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
this.logger.error(`Error: ${error.message}`);
|
|
82
|
-
return 1;
|
|
83
|
-
}
|
|
84
|
-
return 0;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
resolveConfigFromEnv() {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
return {
|
|
90
|
-
// ...super.resolveConfigFromEnv(),
|
|
91
|
-
// BASE COMMAND START
|
|
92
|
-
apiKey: process.env.DATADOG_API_KEY || process.env.DD_API_KEY,
|
|
93
|
-
appKey: process.env.DATADOG_APP_KEY || process.env.DD_APP_KEY,
|
|
94
|
-
configPath: process.env.DATADOG_SYNTHETICS_CONFIG_PATH,
|
|
95
|
-
datadogSite: (0, api_1.getDatadogSiteFromEnv)(),
|
|
96
|
-
// BASE COMMAND END
|
|
97
|
-
files: (_a = process.env.DATADOG_SYNTHETICS_FILES) === null || _a === void 0 ? void 0 : _a.split(';'),
|
|
98
|
-
publicIds: (_b = process.env.DATADOG_SYNTHETICS_PUBLIC_IDS) === null || _b === void 0 ? void 0 : _b.split(';'),
|
|
99
|
-
testSearchQuery: process.env.DATADOG_SYNTHETICS_TEST_SEARCH_QUERY,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
resolveConfigFromCli() {
|
|
103
|
-
return {
|
|
104
|
-
// ...super.resolveConfigFromCli(),
|
|
105
|
-
// BASE COMMAND START
|
|
106
|
-
apiKey: this.apiKey,
|
|
107
|
-
appKey: this.appKey,
|
|
108
|
-
configPath: this.configPath,
|
|
109
|
-
datadogSite: this.datadogSite,
|
|
110
|
-
// BASE COMMAND END
|
|
111
|
-
files: this.files,
|
|
112
|
-
publicIds: this.publicIds,
|
|
113
|
-
testSearchQuery: this.testSearchQuery,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.PluginCommand = PluginCommand;
|
|
118
|
-
//# sourceMappingURL=import-tests.js.map
|
|
1
|
+
"use strict"
|
|
2
|
+
module.exports = require("../bundle.js").commands["import-tests"]
|
|
@@ -1,319 +1,2 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PluginCommand = void 0;
|
|
16
|
-
const run_tests_1 = require("@datadog/datadog-ci-base/commands/synthetics/run-tests");
|
|
17
|
-
const constants_1 = require("@datadog/datadog-ci-base/constants");
|
|
18
|
-
const api_1 = require("@datadog/datadog-ci-base/helpers/api");
|
|
19
|
-
const env_1 = require("@datadog/datadog-ci-base/helpers/env");
|
|
20
|
-
const fips_1 = require("@datadog/datadog-ci-base/helpers/fips");
|
|
21
|
-
const utils_1 = require("@datadog/datadog-ci-base/helpers/utils");
|
|
22
|
-
const validation_1 = require("@datadog/datadog-ci-base/helpers/validation");
|
|
23
|
-
const deep_extend_1 = __importDefault(require("deep-extend"));
|
|
24
|
-
const build_and_test_1 = require("../build-and-test");
|
|
25
|
-
const errors_1 = require("../errors");
|
|
26
|
-
const default_1 = require("../reporters/default");
|
|
27
|
-
const junit_1 = require("../reporters/junit");
|
|
28
|
-
const run_tests_lib_1 = require("../run-tests-lib");
|
|
29
|
-
const internal_1 = require("../utils/internal");
|
|
30
|
-
const public_1 = require("../utils/public");
|
|
31
|
-
class PluginCommand extends run_tests_1.SyntheticsRunTestsCommand {
|
|
32
|
-
constructor() {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
super(...arguments);
|
|
35
|
-
this.config = (0, run_tests_lib_1.getDefaultConfig)();
|
|
36
|
-
this.fipsConfig = {
|
|
37
|
-
fips: (_a = (0, env_1.toBoolean)(process.env[constants_1.FIPS_ENV_VAR])) !== null && _a !== void 0 ? _a : false,
|
|
38
|
-
fipsIgnoreError: (_b = (0, env_1.toBoolean)(process.env[constants_1.FIPS_IGNORE_ERROR_ENV_VAR])) !== null && _b !== void 0 ? _b : false,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
setup() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
(0, fips_1.enableFips)(this.fips || this.fipsConfig.fips, this.fipsIgnoreError || this.fipsConfig.fipsIgnoreError);
|
|
44
|
-
// Bootstrap reporter
|
|
45
|
-
this.reporter = (0, public_1.getReporter)([new default_1.DefaultReporter(this)]);
|
|
46
|
-
// Load config
|
|
47
|
-
yield this.resolveConfig();
|
|
48
|
-
this.normalizeConfig();
|
|
49
|
-
this.validateConfig();
|
|
50
|
-
// Update reporter
|
|
51
|
-
this.reporter = (0, public_1.getReporter)([new default_1.DefaultReporter(this), ...this.getReporters()]);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
resolveConfig() {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
// Defaults < file < ENV < CLI
|
|
58
|
-
// Override with config file variables (e.g. datadog-ci.json)
|
|
59
|
-
try {
|
|
60
|
-
// Override Config Path with ENV variables
|
|
61
|
-
const overrideConfigPath = (_b = (_a = this.configPath) !== null && _a !== void 0 ? _a : process.env.DATADOG_SYNTHETICS_CONFIG_PATH) !== null && _b !== void 0 ? _b : 'datadog-ci.json';
|
|
62
|
-
this.config = yield (0, utils_1.resolveConfigFromFile)(this.config, {
|
|
63
|
-
configPath: overrideConfigPath,
|
|
64
|
-
defaultConfigPaths: [this.config.configPath],
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (this.configPath) {
|
|
69
|
-
throw new errors_1.CiError('INVALID_CONFIG', error.message);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Override with ENV variables
|
|
73
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromEnv()));
|
|
74
|
-
// Override with CLI parameters
|
|
75
|
-
this.config = (0, deep_extend_1.default)(this.config, (0, utils_1.recursivelyRemoveUndefinedValues)(this.resolveConfigFromCli()));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
execute() {
|
|
79
|
-
var _a;
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
try {
|
|
82
|
-
yield this.setup();
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
(0, public_1.reportExitLogs)(this.reporter, this.config, { error });
|
|
86
|
-
return 1;
|
|
87
|
-
}
|
|
88
|
-
const startTime = Date.now();
|
|
89
|
-
if (this.config.tunnel) {
|
|
90
|
-
this.reporter.log('You are using tunnel option, the chosen location(s) will be overridden by a location in your account region.\n');
|
|
91
|
-
}
|
|
92
|
-
let results;
|
|
93
|
-
let summary;
|
|
94
|
-
const orgSettings = yield (0, public_1.getOrgSettings)(this.reporter, this.config);
|
|
95
|
-
if (this.dryRun) {
|
|
96
|
-
try {
|
|
97
|
-
const { testPlan, initialSummary } = yield (0, run_tests_lib_1.planDryRun)(this.reporter, this.config);
|
|
98
|
-
this.reporter.dryRunEnd(initialSummary, testPlan, this.config, orgSettings);
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
(0, public_1.reportExitLogs)(this.reporter, this.config, { error });
|
|
102
|
-
return (0, public_1.toExitCode)((0, public_1.getExitReason)(this.config, { error }));
|
|
103
|
-
}
|
|
104
|
-
return 0;
|
|
105
|
-
}
|
|
106
|
-
let teardown = () => __awaiter(this, void 0, void 0, function* () { });
|
|
107
|
-
const [_, command] = (_a = this.path) !== null && _a !== void 0 ? _a : [];
|
|
108
|
-
if (command === 'build-and-test') {
|
|
109
|
-
if (!this.config.buildCommand) {
|
|
110
|
-
this.reporter.error('The `buildCommand` option is required for the `build-and-test` command.');
|
|
111
|
-
return 1;
|
|
112
|
-
}
|
|
113
|
-
const { builds, devServerUrl, stop } = yield (0, build_and_test_1.buildAssets)(this.config.buildCommand, this.reporter);
|
|
114
|
-
teardown = stop;
|
|
115
|
-
const resourceUrlSubstitutionRegexes = builds.map(
|
|
116
|
-
// All of the resources matching the publicPath prefix will be redirected to the dev server.
|
|
117
|
-
(build) => `.*${build.publicPath}|${devServerUrl}/${build.publicPath}`);
|
|
118
|
-
this.config = (0, deep_extend_1.default)(this.config, {
|
|
119
|
-
tunnel: true,
|
|
120
|
-
defaultTestOverrides: {
|
|
121
|
-
resourceUrlSubstitutionRegexes,
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
;
|
|
127
|
-
({ results, summary } = yield (0, run_tests_lib_1.executeTests)(this.reporter, this.config));
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
(0, public_1.reportExitLogs)(this.reporter, this.config, { error });
|
|
131
|
-
return (0, public_1.toExitCode)((0, public_1.getExitReason)(this.config, { error }));
|
|
132
|
-
}
|
|
133
|
-
finally {
|
|
134
|
-
yield teardown();
|
|
135
|
-
}
|
|
136
|
-
(0, public_1.renderResults)({
|
|
137
|
-
config: this.config,
|
|
138
|
-
orgSettings,
|
|
139
|
-
reporter: this.reporter,
|
|
140
|
-
results,
|
|
141
|
-
startTime,
|
|
142
|
-
summary,
|
|
143
|
-
});
|
|
144
|
-
(0, public_1.reportExitLogs)(this.reporter, this.config, { results });
|
|
145
|
-
return (0, public_1.toExitCode)((0, public_1.getExitReason)(this.config, { results }));
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
resolveConfigFromEnv() {
|
|
149
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
150
|
-
// Override with OVERRIDE ENV variables
|
|
151
|
-
const envOverrideBasicAuth = (0, deep_extend_1.default)((_b = (_a = this.config.defaultTestOverrides) === null || _a === void 0 ? void 0 : _a.basicAuth) !== null && _b !== void 0 ? _b : {}, (0, utils_1.removeUndefinedValues)({
|
|
152
|
-
password: process.env.DATADOG_SYNTHETICS_OVERRIDE_BASIC_AUTH_PASSWORD,
|
|
153
|
-
username: process.env.DATADOG_SYNTHETICS_OVERRIDE_BASIC_AUTH_USERNAME,
|
|
154
|
-
}));
|
|
155
|
-
const envOverrideCookies = (0, utils_1.removeUndefinedValues)({
|
|
156
|
-
append: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_OVERRIDE_COOKIES_APPEND),
|
|
157
|
-
value: process.env.DATADOG_SYNTHETICS_OVERRIDE_COOKIES,
|
|
158
|
-
});
|
|
159
|
-
const envOverrideSetCookies = (0, utils_1.removeUndefinedValues)({
|
|
160
|
-
append: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_OVERRIDE_SET_COOKIES_APPEND),
|
|
161
|
-
value: process.env.DATADOG_SYNTHETICS_OVERRIDE_SET_COOKIES,
|
|
162
|
-
});
|
|
163
|
-
const envOverrideRetryConfig = (0, deep_extend_1.default)((_d = (_c = this.config.defaultTestOverrides) === null || _c === void 0 ? void 0 : _c.retry) !== null && _d !== void 0 ? _d : {}, (0, utils_1.removeUndefinedValues)({
|
|
164
|
-
count: (0, env_1.toNumber)(process.env.DATADOG_SYNTHETICS_OVERRIDE_RETRY_COUNT),
|
|
165
|
-
interval: (0, env_1.toNumber)(process.env.DATADOG_SYNTHETICS_OVERRIDE_RETRY_INTERVAL),
|
|
166
|
-
}));
|
|
167
|
-
return {
|
|
168
|
-
// ...super.resolveConfigFromEnv(),
|
|
169
|
-
// BASE COMMAND START
|
|
170
|
-
apiKey: process.env.DATADOG_API_KEY || process.env.DD_API_KEY,
|
|
171
|
-
appKey: process.env.DATADOG_APP_KEY || process.env.DD_APP_KEY,
|
|
172
|
-
configPath: process.env.DATADOG_SYNTHETICS_CONFIG_PATH,
|
|
173
|
-
datadogSite: (0, api_1.getDatadogSiteFromEnv)(),
|
|
174
|
-
// BASE COMMAND END
|
|
175
|
-
batchTimeout: (0, env_1.toNumber)(process.env.DATADOG_SYNTHETICS_BATCH_TIMEOUT),
|
|
176
|
-
buildCommand: process.env.DATADOG_SYNTHETICS_BUILD_COMMAND,
|
|
177
|
-
defaultTestOverrides: {
|
|
178
|
-
allowInsecureCertificates: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_OVERRIDE_ALLOW_INSECURE_CERTIFICATES),
|
|
179
|
-
basicAuth: Object.keys(envOverrideBasicAuth).length > 0 ? envOverrideBasicAuth : undefined,
|
|
180
|
-
body: process.env.DATADOG_SYNTHETICS_OVERRIDE_BODY,
|
|
181
|
-
bodyType: process.env.DATADOG_SYNTHETICS_OVERRIDE_BODY_TYPE,
|
|
182
|
-
cookies: Object.keys(envOverrideCookies).length > 0 ? envOverrideCookies : undefined,
|
|
183
|
-
setCookies: Object.keys(envOverrideSetCookies).length > 0 ? envOverrideSetCookies : undefined,
|
|
184
|
-
defaultStepTimeout: (0, env_1.toNumber)(process.env.DATADOG_SYNTHETICS_OVERRIDE_DEFAULT_STEP_TIMEOUT),
|
|
185
|
-
deviceIds: (_e = process.env.DATADOG_SYNTHETICS_OVERRIDE_DEVICE_IDS) === null || _e === void 0 ? void 0 : _e.split(';'),
|
|
186
|
-
executionRule: (0, internal_1.toExecutionRule)(process.env.DATADOG_SYNTHETICS_OVERRIDE_EXECUTION_RULE),
|
|
187
|
-
followRedirects: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_OVERRIDE_FOLLOW_REDIRECTS),
|
|
188
|
-
headers: (0, env_1.toStringMap)(process.env.DATADOG_SYNTHETICS_OVERRIDE_HEADERS),
|
|
189
|
-
locations: (_f = process.env.DATADOG_SYNTHETICS_OVERRIDE_LOCATIONS) === null || _f === void 0 ? void 0 : _f.split(';'),
|
|
190
|
-
mobileApplicationVersion: process.env.DATADOG_SYNTHETICS_OVERRIDE_MOBILE_APPLICATION_VERSION,
|
|
191
|
-
resourceUrlSubstitutionRegexes: (_g = process.env.DATADOG_SYNTHETICS_OVERRIDE_RESOURCE_URL_SUBSTITUTION_REGEXES) === null || _g === void 0 ? void 0 : _g.split(';'),
|
|
192
|
-
retry: Object.keys(envOverrideRetryConfig).length > 0 ? envOverrideRetryConfig : undefined,
|
|
193
|
-
startUrl: process.env.DATADOG_SYNTHETICS_OVERRIDE_START_URL,
|
|
194
|
-
startUrlSubstitutionRegex: process.env.DATADOG_SYNTHETICS_OVERRIDE_START_URL_SUBSTITUTION_REGEX,
|
|
195
|
-
testTimeout: (0, env_1.toNumber)(process.env.DATADOG_SYNTHETICS_OVERRIDE_TEST_TIMEOUT),
|
|
196
|
-
variables: (0, env_1.toStringMap)(process.env.DATADOG_SYNTHETICS_OVERRIDE_VARIABLES),
|
|
197
|
-
},
|
|
198
|
-
failOnCriticalErrors: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_FAIL_ON_CRITICAL_ERRORS),
|
|
199
|
-
failOnMissingTests: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_FAIL_ON_MISSING_TESTS),
|
|
200
|
-
failOnTimeout: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_FAIL_ON_TIMEOUT),
|
|
201
|
-
files: (_h = process.env.DATADOG_SYNTHETICS_FILES) === null || _h === void 0 ? void 0 : _h.split(';'),
|
|
202
|
-
jUnitReport: process.env.DATADOG_SYNTHETICS_JUNIT_REPORT,
|
|
203
|
-
publicIds: (_j = process.env.DATADOG_SYNTHETICS_PUBLIC_IDS) === null || _j === void 0 ? void 0 : _j.split(';'),
|
|
204
|
-
selectiveRerun: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_SELECTIVE_RERUN),
|
|
205
|
-
subdomain: process.env.DATADOG_SUBDOMAIN,
|
|
206
|
-
testSearchQuery: process.env.DATADOG_SYNTHETICS_TEST_SEARCH_QUERY,
|
|
207
|
-
tunnel: (0, env_1.toBoolean)(process.env.DATADOG_SYNTHETICS_TUNNEL),
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
resolveConfigFromCli() {
|
|
211
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
212
|
-
// Override defaultTestOverrides with CLI parameters
|
|
213
|
-
let validatedOverrides;
|
|
214
|
-
try {
|
|
215
|
-
validatedOverrides = (0, internal_1.validateAndParseOverrides)(this.overrides);
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
throw new errors_1.CiError('INVALID_CONFIG', error.message);
|
|
219
|
-
}
|
|
220
|
-
const cliOverrideBasicAuth = (0, deep_extend_1.default)((_b = (_a = this.config.defaultTestOverrides) === null || _a === void 0 ? void 0 : _a.basicAuth) !== null && _b !== void 0 ? _b : {}, (0, utils_1.removeUndefinedValues)({
|
|
221
|
-
password: (_c = validatedOverrides.basicAuth) === null || _c === void 0 ? void 0 : _c.password,
|
|
222
|
-
username: (_d = validatedOverrides.basicAuth) === null || _d === void 0 ? void 0 : _d.username,
|
|
223
|
-
}));
|
|
224
|
-
const cliOverrideCookies = (0, utils_1.removeUndefinedValues)({
|
|
225
|
-
append: (_e = validatedOverrides.cookies) === null || _e === void 0 ? void 0 : _e.append,
|
|
226
|
-
value: (_f = validatedOverrides.cookies) === null || _f === void 0 ? void 0 : _f.value,
|
|
227
|
-
});
|
|
228
|
-
const cliOverrideSetCookies = (0, utils_1.removeUndefinedValues)({
|
|
229
|
-
append: (_g = validatedOverrides.setCookies) === null || _g === void 0 ? void 0 : _g.append,
|
|
230
|
-
value: (_h = validatedOverrides.setCookies) === null || _h === void 0 ? void 0 : _h.value,
|
|
231
|
-
});
|
|
232
|
-
const cliOverrideRetryConfig = (0, deep_extend_1.default)((_k = (_j = this.config.defaultTestOverrides) === null || _j === void 0 ? void 0 : _j.retry) !== null && _k !== void 0 ? _k : {}, (0, utils_1.removeUndefinedValues)({
|
|
233
|
-
count: (_l = validatedOverrides.retry) === null || _l === void 0 ? void 0 : _l.count,
|
|
234
|
-
interval: (_m = validatedOverrides.retry) === null || _m === void 0 ? void 0 : _m.interval,
|
|
235
|
-
}));
|
|
236
|
-
return {
|
|
237
|
-
// ...super.resolveConfigFromCli(),
|
|
238
|
-
// BASE COMMAND START
|
|
239
|
-
apiKey: this.apiKey,
|
|
240
|
-
appKey: this.appKey,
|
|
241
|
-
configPath: this.configPath,
|
|
242
|
-
datadogSite: this.datadogSite,
|
|
243
|
-
// BASE COMMAND END
|
|
244
|
-
batchTimeout: this.batchTimeout,
|
|
245
|
-
buildCommand: this.buildCommand,
|
|
246
|
-
defaultTestOverrides: {
|
|
247
|
-
allowInsecureCertificates: validatedOverrides.allowInsecureCertificates,
|
|
248
|
-
basicAuth: Object.keys(cliOverrideBasicAuth).length > 0 ? cliOverrideBasicAuth : undefined,
|
|
249
|
-
body: validatedOverrides.body,
|
|
250
|
-
bodyType: validatedOverrides.bodyType,
|
|
251
|
-
cookies: Object.keys(cliOverrideCookies).length > 0 ? cliOverrideCookies : undefined,
|
|
252
|
-
setCookies: Object.keys(cliOverrideSetCookies).length > 0 ? cliOverrideSetCookies : undefined,
|
|
253
|
-
defaultStepTimeout: validatedOverrides.defaultStepTimeout,
|
|
254
|
-
deviceIds: validatedOverrides.deviceIds,
|
|
255
|
-
executionRule: validatedOverrides.executionRule,
|
|
256
|
-
followRedirects: validatedOverrides.followRedirects,
|
|
257
|
-
headers: validatedOverrides.headers,
|
|
258
|
-
locations: validatedOverrides.locations,
|
|
259
|
-
mobileApplicationVersion: this.mobileApplicationVersion,
|
|
260
|
-
mobileApplicationVersionFilePath: this.mobileApplicationVersionFilePath,
|
|
261
|
-
resourceUrlSubstitutionRegexes: validatedOverrides.resourceUrlSubstitutionRegexes,
|
|
262
|
-
retry: Object.keys(cliOverrideRetryConfig).length > 0 ? cliOverrideRetryConfig : undefined,
|
|
263
|
-
startUrl: validatedOverrides.startUrl,
|
|
264
|
-
startUrlSubstitutionRegex: validatedOverrides.startUrlSubstitutionRegex,
|
|
265
|
-
testTimeout: validatedOverrides.testTimeout,
|
|
266
|
-
variables: validatedOverrides.variables,
|
|
267
|
-
},
|
|
268
|
-
failOnCriticalErrors: this.failOnCriticalErrors,
|
|
269
|
-
failOnMissingTests: this.failOnMissingTests,
|
|
270
|
-
failOnTimeout: this.failOnTimeout,
|
|
271
|
-
files: this.files,
|
|
272
|
-
jUnitReport: this.jUnitReport,
|
|
273
|
-
publicIds: this.publicIds,
|
|
274
|
-
selectiveRerun: this.selectiveRerun,
|
|
275
|
-
subdomain: this.subdomain,
|
|
276
|
-
testSearchQuery: this.testSearchQuery,
|
|
277
|
-
tunnel: this.tunnel,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
normalizeConfig() {
|
|
281
|
-
var _a, _b;
|
|
282
|
-
// Convert cookies to object
|
|
283
|
-
if (typeof ((_a = this.config.defaultTestOverrides) === null || _a === void 0 ? void 0 : _a.cookies) === 'string') {
|
|
284
|
-
this.config.defaultTestOverrides.cookies = { value: this.config.defaultTestOverrides.cookies };
|
|
285
|
-
}
|
|
286
|
-
// Convert setCookies to object
|
|
287
|
-
if (typeof ((_b = this.config.defaultTestOverrides) === null || _b === void 0 ? void 0 : _b.setCookies) === 'string') {
|
|
288
|
-
this.config.defaultTestOverrides.setCookies = { value: this.config.defaultTestOverrides.setCookies };
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
validateConfig() {
|
|
292
|
-
var _a, _b;
|
|
293
|
-
if (!(0, validation_1.isValidDatadogSite)(this.config.datadogSite)) {
|
|
294
|
-
throw new errors_1.CiError('INVALID_CONFIG', `The \`datadogSite\` config property (${JSON.stringify(this.config.datadogSite)}) must match one of the sites supported by Datadog.\nFor more information, see "Site parameter" in our documentation: https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site`);
|
|
295
|
-
}
|
|
296
|
-
if (typeof ((_a = this.config.defaultTestOverrides) === null || _a === void 0 ? void 0 : _a.cookies) === 'object' &&
|
|
297
|
-
!this.config.defaultTestOverrides.cookies.value) {
|
|
298
|
-
throw new errors_1.CiError('INVALID_CONFIG', 'Cookies value cannot be empty.');
|
|
299
|
-
}
|
|
300
|
-
if (typeof ((_b = this.config.defaultTestOverrides) === null || _b === void 0 ? void 0 : _b.setCookies) === 'object' &&
|
|
301
|
-
!this.config.defaultTestOverrides.setCookies.value) {
|
|
302
|
-
throw new errors_1.CiError('INVALID_CONFIG', 'SetCookies value cannot be empty.');
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
getReporters() {
|
|
306
|
-
if (this.config.jUnitReport) {
|
|
307
|
-
return [
|
|
308
|
-
new junit_1.JUnitReporter({
|
|
309
|
-
context: this.context,
|
|
310
|
-
jUnitReport: this.config.jUnitReport,
|
|
311
|
-
runName: this.runName,
|
|
312
|
-
}),
|
|
313
|
-
];
|
|
314
|
-
}
|
|
315
|
-
return [];
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
exports.PluginCommand = PluginCommand;
|
|
319
|
-
//# sourceMappingURL=run-tests.js.map
|
|
1
|
+
"use strict"
|
|
2
|
+
module.exports = require("../bundle.js").commands["run-tests"]
|