runner-runtime 1.0.16 → 1.0.17
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 +17 -9
- package/index.js +2 -2
- package/package.json +3 -3
- package/test.js +2 -2
package/events/api.js
CHANGED
|
@@ -2264,18 +2264,26 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
|
|
|
2264
2264
|
}
|
|
2265
2265
|
|
|
2266
2266
|
// 写入到自动化测试结果
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
resolve(_.assign({
|
|
2272
|
-
action: 'request',
|
|
2267
|
+
const finalRequestResult = _.assign({
|
|
2268
|
+
action: 'httpRequestCompleted',
|
|
2273
2269
|
data: camelCaseToSnakeCase(_.get(eventRuntimeData, event?.event_id)),
|
|
2274
2270
|
error: _.get(eventRuntimeData, [event?.event_id, 'error', 'message']) || null,
|
|
2275
2271
|
event_id: event?.event_id,
|
|
2276
|
-
iteration_id: _.get(eventRuntimeData, [event?.event_id, 'iteration_id'])
|
|
2277
|
-
|
|
2278
|
-
|
|
2272
|
+
iteration_id: _.get(eventRuntimeData, [event?.event_id, 'iteration_id'])
|
|
2273
|
+
}, _.pick(requestJson, ['parent_id', 'project_id', 'test_id', 'target_id']));
|
|
2274
|
+
|
|
2275
|
+
if (scene === 'auto_test' && _.includes(['assert', 'assert_visual', 'api', 'sample'], event?.type)) {
|
|
2276
|
+
eventResultList.push(_.assign(camelCaseToSnakeCase(_.get(eventRuntimeData, event?.event_id)), _.pick(event, ['type', 'event_id', 'test_id', 'iteration_id'])));
|
|
2277
|
+
|
|
2278
|
+
resolve({
|
|
2279
|
+
action: 'request',
|
|
2280
|
+
data: _.assign(finalRequestResult, {
|
|
2281
|
+
type: 'request'
|
|
2282
|
+
})
|
|
2283
|
+
})
|
|
2284
|
+
} else {
|
|
2285
|
+
resolve(finalRequestResult)
|
|
2286
|
+
}
|
|
2279
2287
|
}
|
|
2280
2288
|
}
|
|
2281
2289
|
})
|
package/index.js
CHANGED
|
@@ -58,7 +58,7 @@ const run = async (events, option, callback) => {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const request2HAR = async (events, option) => {
|
|
62
62
|
const eventOptions = _.pick(option, ["scene", "lang", "project", "env", "globals", "cookies", "system_configs", "custom_functions", "collection", "database_configs", "enable_sandbox", "sleep", "name", "testing_id"]);
|
|
63
63
|
const eventRuntimeData = {
|
|
64
64
|
variables: {}
|
|
@@ -76,4 +76,4 @@ const getHar = async (events, option) => {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
module.exports = { run,
|
|
79
|
+
module.exports = { run, request2HAR }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runner-runtime",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.17",
|
|
4
|
+
"description": "runner-runtime.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "git+https://github.com/Apipost-Team/runner-runtime.git"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
|
-
"
|
|
14
|
+
"runner-runtime"
|
|
15
15
|
],
|
|
16
16
|
"author": "Daniel Anderson <support@echoapi.com> (https://github.com/Apipost-Team)",
|
|
17
17
|
"license": "MIT",
|
package/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _ =require('lodash');
|
|
2
|
-
const {
|
|
2
|
+
const { request2HAR } = require('./index');
|
|
3
3
|
|
|
4
4
|
// 以下为调用示例
|
|
5
5
|
const callback = (res) => {
|
|
@@ -121,4 +121,4 @@ const callback = (res) => {
|
|
|
121
121
|
})();
|
|
122
122
|
//pip end
|
|
123
123
|
const { option, test_events } = require('./tmp/request'); // tmp todo...
|
|
124
|
-
|
|
124
|
+
request2HAR(test_events, option, callback);
|