runner-runtime 1.0.26 → 1.0.28
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/events/api.js +23 -3
- package/events/index.js +14 -0
- package/index.js +6 -1
- package/package.json +2 -2
- package/tmp/request.js +300 -1319
package/events/api.js
CHANGED
|
@@ -2156,7 +2156,15 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2156
2156
|
const currentVar = _.get(result, `result.${varType}`);
|
|
2157
2157
|
try {
|
|
2158
2158
|
_.forEach(currentVar.toObject(), (val, key) => {
|
|
2159
|
-
|
|
2159
|
+
let setPath = varType;
|
|
2160
|
+
if (varType === '_variables') {
|
|
2161
|
+
setPath = 'variables';
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
if (varType === 'globals' && !_.includes(_.keys(getInsideVariables()),key)) {
|
|
2165
|
+
_.set(eventRuntimeData, ["variables", '_globals', key], val)
|
|
2166
|
+
}
|
|
2167
|
+
_.set(eventRuntimeData, ["variables", setPath, key], val)
|
|
2160
2168
|
})
|
|
2161
2169
|
} catch (e) { }
|
|
2162
2170
|
})
|
|
@@ -2211,7 +2219,15 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2211
2219
|
const currentVar = _.get(result, `result.${varType}`);
|
|
2212
2220
|
try {
|
|
2213
2221
|
_.forEach(currentVar.toObject(), (val, key) => {
|
|
2214
|
-
|
|
2222
|
+
let setPath = varType;
|
|
2223
|
+
if (varType === '_variables') {
|
|
2224
|
+
setPath = 'variables';
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
if (varType === 'globals' && !_.includes(_.keys(getInsideVariables()),key)) {
|
|
2228
|
+
_.set(eventRuntimeData, ["variables", '_globals', key], val)
|
|
2229
|
+
}
|
|
2230
|
+
_.set(eventRuntimeData, ["variables", setPath, key], val)
|
|
2215
2231
|
})
|
|
2216
2232
|
} catch (e) { }
|
|
2217
2233
|
})
|
|
@@ -2269,9 +2285,13 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2269
2285
|
}
|
|
2270
2286
|
|
|
2271
2287
|
// 写入到自动化测试结果
|
|
2288
|
+
console.log(JSON.stringify(eventRuntimeData?.variables, null, 2))
|
|
2272
2289
|
const finalRequestResult = _.assign({
|
|
2273
2290
|
action: 'httpRequestCompleted',
|
|
2274
|
-
data:
|
|
2291
|
+
data: _.assign(
|
|
2292
|
+
{
|
|
2293
|
+
'variables': _.get(eventRuntimeData, 'variables')
|
|
2294
|
+
}, camelCaseToSnakeCase(_.get(eventRuntimeData, event?.event_id))),
|
|
2275
2295
|
error: _.get(eventRuntimeData, [event?.event_id, 'error', 'message']) || null,
|
|
2276
2296
|
event_id: event?.event_id,
|
|
2277
2297
|
iteration_id: _.get(eventRuntimeData, [event?.event_id, 'iteration_id'])
|
package/events/index.js
CHANGED
|
@@ -201,6 +201,20 @@ const executeEvent = (event, option, callback, eventRuntimeData, eventResultList
|
|
|
201
201
|
iteration_id: aTools.snowflakeId()
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
+
|
|
205
|
+
const environment = _.get(option, 'env.environment', {});
|
|
206
|
+
const globals = _.get(option, 'globals', {});
|
|
207
|
+
const iterationData = _.get(option, 'iterationData', {});
|
|
208
|
+
const tempVars = { environment, globals, iterationData };
|
|
209
|
+
|
|
210
|
+
['environment', 'globals', 'iterationData'].forEach((type) => {
|
|
211
|
+
_.forEach(tempVars[type], (value, key) => {
|
|
212
|
+
if (_.isUndefined(_.get(eventRuntimeData, ['variables', type, key]))) {
|
|
213
|
+
_.set(eventRuntimeData, ['variables', type, key], value)
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
|
|
204
218
|
const eventCall = _.get(events, `${event?.type}`);
|
|
205
219
|
|
|
206
220
|
if (_.isFunction(eventCall)) {
|
package/index.js
CHANGED
|
@@ -12,8 +12,13 @@ const run = async (events, option, callback) => {
|
|
|
12
12
|
const iterationDataArr = repeatArrayToLength(iterationData, _.size(tempEvents));
|
|
13
13
|
const eventOptions = _.pick(option, ["scene", "lang", "project", "env", "globals", "cookies", "system_configs", "custom_functions", "collection", "database_configs", "enable_sandbox", "sleep", "name", "testing_id"]);
|
|
14
14
|
const eventRuntimeData = {
|
|
15
|
-
variables: {
|
|
15
|
+
variables: {
|
|
16
|
+
environment:{},
|
|
17
|
+
globals:{},
|
|
18
|
+
iterationData:{},
|
|
19
|
+
}
|
|
16
20
|
};
|
|
21
|
+
|
|
17
22
|
const eventResultList = [];
|
|
18
23
|
const startTimeAt = Date.now();
|
|
19
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runner-runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "runner-runtime.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"postman-collection": "^5.0.2",
|
|
42
42
|
"postman-runtime-pro": "^7.43.15",
|
|
43
43
|
"request-har": "^1.0.0",
|
|
44
|
-
"strip-json-comments": "^
|
|
44
|
+
"strip-json-comments": "^3.1.1",
|
|
45
45
|
"tough": "^0.6.0",
|
|
46
46
|
"tough-cookie": "^5.1.2",
|
|
47
47
|
"uuid": "^9.0.1",
|