runner-runtime 1.0.10 → 1.0.12

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 CHANGED
@@ -9,7 +9,7 @@ const FileType = require("file-type"),
9
9
  tough = require("tough-cookie"),
10
10
  Buffer = require("buffer/").Buffer,
11
11
  isImage = require("is-image");
12
- const { getAPIFromCollection, smartUrlJoin, replace2RegExp, getParentTargetIDs, base64toCacheFile, getInsideVariables, getCaseInsensitive } = require('../libs/utils'),
12
+ const { getAPIFromCollection, smartUrlJoin, replace2RegExp, getParentTargetIDs, base64toCacheFile, getInsideVariables, getCaseInsensitive,camelCaseToSnakeCase } = require('../libs/utils'),
13
13
  _ = require('lodash');
14
14
  const sdk = require("postman-collection"),
15
15
  Url = sdk.Url,
@@ -1552,7 +1552,10 @@ async function convert2EchoResponse(response, history) {
1552
1552
  }
1553
1553
 
1554
1554
  _.assign(cloneResponse, { mimeType, fitForShow });
1555
- } catch (e) { }
1555
+ } catch (e) {
1556
+
1557
+ console.log(e,1111)
1558
+ }
1556
1559
 
1557
1560
  // 响应头对象
1558
1561
  const responseHeader = {};
@@ -2252,19 +2255,20 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2252
2255
 
2253
2256
  // 写入到自动化测试结果
2254
2257
  if (scene === 'auto_test' && _.includes(['assert', 'assert_visual', 'api', 'sample'], event?.type)) {
2255
- eventResultList.push(_.assign(_.get(eventRuntimeData, event?.event_id), _.pick(event, ['type', 'event_id', 'test_id']), {
2258
+ eventResultList.push(_.assign(camelCaseToSnakeCase(_.get(eventRuntimeData, event?.event_id)), _.pick(event, ['type', 'event_id', 'test_id']), {
2256
2259
  iteration_id: aTools.snowflakeId()
2257
2260
  }))
2258
2261
  }
2259
2262
  }
2260
2263
 
2261
- resolve({
2264
+ resolve(_.assign({
2262
2265
  action: 'httpRequestCompleted',
2263
- data: _.get(eventRuntimeData, event?.event_id),
2266
+ data: camelCaseToSnakeCase(_.get(eventRuntimeData, event?.event_id)),
2264
2267
  error: _.get(eventRuntimeData, [event?.event_id, 'error', 'message']) || null,
2265
2268
  event_id: event?.event_id,
2266
- target_id: requestJson?.target_id
2267
- })
2269
+ iteration_id: aTools.snowflakeId(),
2270
+ type: 'request'
2271
+ }, _.pick(requestJson, ['parent_id', 'project_id', 'test_id', 'target_id'])))
2268
2272
  }
2269
2273
  })
2270
2274
  }
package/libs/utils.js CHANGED
@@ -485,6 +485,20 @@ const formatAutotestReport = (startTimeAt, eventResultList) => {
485
485
  report.total_response_size = totalResponseSize;
486
486
  return report;
487
487
  }
488
+
489
+
490
+ const camelCaseToSnakeCase = (obj) => {
491
+ ["arrCookies", "fitForShow", "mimeType", "requestStart", "responseSize", "responseTime",].forEach((key) => {
492
+ const _key = _.snakeCase(key);
493
+ const objValue = _.get(obj, `response.${key}`);
494
+ if (!_.isUndefined(objValue)) {
495
+ _.set(obj, `response.${_key}`, objValue);
496
+ _.unset(obj, `response.${key}`);
497
+ }
498
+ });
499
+
500
+ return obj;
501
+ }
488
502
  module.exports = {
489
503
  atomicSleep,
490
504
  getAPIFromCollection,
@@ -495,6 +509,7 @@ module.exports = {
495
509
  repeatArrayToLength,
496
510
  returnBoolean,
497
511
  getCaseInsensitive,
512
+ camelCaseToSnakeCase,
498
513
  variableReplace,
499
514
  // createPipeServer,
500
515
  formatAutotestReport,
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Processing data returned by AI.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Apipost-Team/runner-runtime.git"
10
+ "type": "git",
11
+ "url": "git+https://github.com/Apipost-Team/runner-runtime.git"
12
12
  },
13
13
  "keywords": [
14
- "auto-json-faker"
14
+ "auto-json-faker"
15
15
  ],
16
16
  "author": "Daniel Anderson <support@echoapi.com> (https://github.com/Apipost-Team)",
17
17
  "license": "MIT",
18
18
  "bugs": {
19
- "url": "https://github.com/Apipost-Team/runner-runtime/issues"
19
+ "url": "https://github.com/Apipost-Team/runner-runtime/issues"
20
20
  },
21
21
  "homepage": "https://github.com/Apipost-Team/runner-runtime#readme",
22
22
  "dependencies": {