@datadog/datadog-ci 2.47.0 → 3.0.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.
Files changed (408) hide show
  1. package/README.md +9 -2
  2. package/dist/__tests__/cli.test.d.ts +1 -0
  3. package/dist/__tests__/cli.test.js +92 -0
  4. package/dist/__tests__/cli.test.js.map +1 -0
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/cloud-run/__tests__/fixtures.d.ts +2 -0
  8. package/dist/commands/cloud-run/__tests__/fixtures.js +12 -0
  9. package/dist/commands/cloud-run/__tests__/fixtures.js.map +1 -0
  10. package/dist/commands/cloud-run/__tests__/flare.test.d.ts +1 -0
  11. package/dist/commands/cloud-run/__tests__/flare.test.js +557 -0
  12. package/dist/commands/cloud-run/__tests__/flare.test.js.map +1 -0
  13. package/dist/commands/coverage/__tests__/upload.test.d.ts +1 -0
  14. package/dist/commands/coverage/__tests__/upload.test.js +323 -0
  15. package/dist/commands/coverage/__tests__/upload.test.js.map +1 -0
  16. package/dist/commands/coverage/__tests__/utils.test.d.ts +1 -0
  17. package/dist/commands/coverage/__tests__/utils.test.js +57 -0
  18. package/dist/commands/coverage/__tests__/utils.test.js.map +1 -0
  19. package/dist/commands/coverage/api.d.ts +9 -0
  20. package/dist/commands/coverage/api.js +52 -0
  21. package/dist/commands/coverage/api.js.map +1 -0
  22. package/dist/commands/coverage/cli.d.ts +1 -0
  23. package/dist/commands/coverage/cli.js +5 -0
  24. package/dist/commands/coverage/cli.js.map +1 -0
  25. package/dist/commands/coverage/interfaces.d.ts +13 -0
  26. package/dist/commands/coverage/interfaces.js +3 -0
  27. package/dist/commands/coverage/interfaces.js.map +1 -0
  28. package/dist/commands/coverage/renderer.d.ts +12 -0
  29. package/dist/commands/coverage/renderer.js +83 -0
  30. package/dist/commands/coverage/renderer.js.map +1 -0
  31. package/dist/commands/coverage/upload.d.ts +27 -0
  32. package/dist/commands/coverage/upload.js +329 -0
  33. package/dist/commands/coverage/upload.js.map +1 -0
  34. package/dist/commands/coverage/utils.d.ts +3 -0
  35. package/dist/commands/coverage/utils.js +83 -0
  36. package/dist/commands/coverage/utils.js.map +1 -0
  37. package/dist/commands/deployment/__tests__/correlate.test.d.ts +1 -0
  38. package/dist/commands/deployment/__tests__/correlate.test.js +106 -0
  39. package/dist/commands/deployment/__tests__/correlate.test.js.map +1 -0
  40. package/dist/commands/deployment/__tests__/mark.test.d.ts +1 -0
  41. package/dist/commands/deployment/__tests__/mark.test.js +97 -0
  42. package/dist/commands/deployment/__tests__/mark.test.js.map +1 -0
  43. package/dist/commands/dora/__tests__/deployment.test.d.ts +1 -0
  44. package/dist/commands/dora/__tests__/deployment.test.js +201 -0
  45. package/dist/commands/dora/__tests__/deployment.test.js.map +1 -0
  46. package/dist/commands/dsyms/__tests__/upload.test.d.ts +1 -0
  47. package/dist/commands/dsyms/__tests__/upload.test.js +346 -0
  48. package/dist/commands/dsyms/__tests__/upload.test.js.map +1 -0
  49. package/dist/commands/dsyms/__tests__/utils.test.d.ts +1 -0
  50. package/dist/commands/dsyms/__tests__/utils.test.js +100 -0
  51. package/dist/commands/dsyms/__tests__/utils.test.js.map +1 -0
  52. package/dist/commands/dsyms/upload.js +3 -3
  53. package/dist/commands/dsyms/upload.js.map +1 -1
  54. package/dist/commands/dsyms/utils.js +7 -6
  55. package/dist/commands/dsyms/utils.js.map +1 -1
  56. package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +1 -0
  57. package/dist/commands/elf-symbols/__tests__/elf.test.js +819 -0
  58. package/dist/commands/elf-symbols/__tests__/elf.test.js.map +1 -0
  59. package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +1 -0
  60. package/dist/commands/elf-symbols/__tests__/upload.test.js +224 -0
  61. package/dist/commands/elf-symbols/__tests__/upload.test.js.map +1 -0
  62. package/dist/commands/elf-symbols/elf.d.ts +1 -0
  63. package/dist/commands/elf-symbols/upload.js +2 -3
  64. package/dist/commands/elf-symbols/upload.js.map +1 -1
  65. package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +1 -0
  66. package/dist/commands/flutter-symbols/__tests__/upload.test.js +617 -0
  67. package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +1 -0
  68. package/dist/commands/flutter-symbols/upload.js +2 -2
  69. package/dist/commands/flutter-symbols/upload.js.map +1 -1
  70. package/dist/commands/gate/__tests__/evaluate.test.d.ts +1 -0
  71. package/dist/commands/gate/__tests__/evaluate.test.js +398 -0
  72. package/dist/commands/gate/__tests__/evaluate.test.js.map +1 -0
  73. package/dist/commands/gate/__tests__/scope.test.d.ts +1 -0
  74. package/dist/commands/gate/__tests__/scope.test.js +29 -0
  75. package/dist/commands/gate/__tests__/scope.test.js.map +1 -0
  76. package/dist/commands/git-metadata/__tests__/git.test.d.ts +1 -0
  77. package/dist/commands/git-metadata/__tests__/git.test.js +132 -0
  78. package/dist/commands/git-metadata/__tests__/git.test.js.map +1 -0
  79. package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +1 -0
  80. package/dist/commands/git-metadata/__tests__/gitdb.test.js +1386 -0
  81. package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +1 -0
  82. package/dist/commands/git-metadata/__tests__/library.test.d.ts +1 -0
  83. package/dist/commands/git-metadata/__tests__/library.test.js +118 -0
  84. package/dist/commands/git-metadata/__tests__/library.test.js.map +1 -0
  85. package/dist/commands/git-metadata/__tests__/upload.test.d.ts +1 -0
  86. package/dist/commands/git-metadata/__tests__/upload.test.js +52 -0
  87. package/dist/commands/git-metadata/__tests__/upload.test.js.map +1 -0
  88. package/dist/commands/git-metadata/upload.d.ts +0 -1
  89. package/dist/commands/git-metadata/upload.js +0 -6
  90. package/dist/commands/git-metadata/upload.js.map +1 -1
  91. package/dist/commands/junit/__tests__/upload.test.d.ts +1 -0
  92. package/dist/commands/junit/__tests__/upload.test.js +446 -0
  93. package/dist/commands/junit/__tests__/upload.test.js.map +1 -0
  94. package/dist/commands/junit/renderer.d.ts +0 -1
  95. package/dist/commands/junit/renderer.js +1 -5
  96. package/dist/commands/junit/renderer.js.map +1 -1
  97. package/dist/commands/junit/upload.d.ts +0 -2
  98. package/dist/commands/junit/upload.js +8 -21
  99. package/dist/commands/junit/upload.js.map +1 -1
  100. package/dist/commands/lambda/__tests__/fixtures.d.ts +51 -0
  101. package/dist/commands/lambda/__tests__/fixtures.js +146 -0
  102. package/dist/commands/lambda/__tests__/fixtures.js.map +1 -0
  103. package/dist/commands/lambda/__tests__/flare.test.d.ts +1 -0
  104. package/dist/commands/lambda/__tests__/flare.test.js +730 -0
  105. package/dist/commands/lambda/__tests__/flare.test.js.map +1 -0
  106. package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +1 -0
  107. package/dist/commands/lambda/__tests__/functions/commons.test.js +791 -0
  108. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +1 -0
  109. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +1 -0
  110. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +386 -0
  111. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +1 -0
  112. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +1 -0
  113. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +721 -0
  114. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +1 -0
  115. package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +1 -0
  116. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +513 -0
  117. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +1 -0
  118. package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +1 -0
  119. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +33 -0
  120. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +1 -0
  121. package/dist/commands/lambda/__tests__/instrument.test.d.ts +1 -0
  122. package/dist/commands/lambda/__tests__/instrument.test.js +1537 -0
  123. package/dist/commands/lambda/__tests__/instrument.test.js.map +1 -0
  124. package/dist/commands/lambda/__tests__/loggroup.test.d.ts +1 -0
  125. package/dist/commands/lambda/__tests__/loggroup.test.js +340 -0
  126. package/dist/commands/lambda/__tests__/loggroup.test.js.map +1 -0
  127. package/dist/commands/lambda/__tests__/prompt.test.d.ts +1 -0
  128. package/dist/commands/lambda/__tests__/prompt.test.js +206 -0
  129. package/dist/commands/lambda/__tests__/prompt.test.js.map +1 -0
  130. package/dist/commands/lambda/__tests__/tags.test.d.ts +1 -0
  131. package/dist/commands/lambda/__tests__/tags.test.js +305 -0
  132. package/dist/commands/lambda/__tests__/tags.test.js.map +1 -0
  133. package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +1 -0
  134. package/dist/commands/lambda/__tests__/uninstrument.test.js +722 -0
  135. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +1 -0
  136. package/dist/commands/lambda/constants.d.ts +2 -0
  137. package/dist/commands/lambda/constants.js +4 -0
  138. package/dist/commands/lambda/constants.js.map +1 -1
  139. package/dist/commands/lambda/functions/commons.d.ts +1 -1
  140. package/dist/commands/measure/__tests__/measure.test.d.ts +1 -0
  141. package/dist/commands/measure/__tests__/measure.test.js +102 -0
  142. package/dist/commands/measure/__tests__/measure.test.js.map +1 -0
  143. package/dist/commands/measure/measure.d.ts +0 -1
  144. package/dist/commands/measure/measure.js +2 -9
  145. package/dist/commands/measure/measure.js.map +1 -1
  146. package/dist/commands/react-native/__tests__/codepush.test.d.ts +1 -0
  147. package/dist/commands/react-native/__tests__/codepush.test.js +161 -0
  148. package/dist/commands/react-native/__tests__/codepush.test.js.map +1 -0
  149. package/dist/commands/react-native/__tests__/interfaces.test.d.ts +1 -0
  150. package/dist/commands/react-native/__tests__/interfaces.test.js +33 -0
  151. package/dist/commands/react-native/__tests__/interfaces.test.js.map +1 -0
  152. package/dist/commands/react-native/__tests__/upload.test.d.ts +1 -0
  153. package/dist/commands/react-native/__tests__/upload.test.js +238 -0
  154. package/dist/commands/react-native/__tests__/upload.test.js.map +1 -0
  155. package/dist/commands/react-native/__tests__/utils.test.d.ts +1 -0
  156. package/dist/commands/react-native/__tests__/utils.test.js +27 -0
  157. package/dist/commands/react-native/__tests__/utils.test.js.map +1 -0
  158. package/dist/commands/react-native/__tests__/xcode.test.d.ts +1 -0
  159. package/dist/commands/react-native/__tests__/xcode.test.js +465 -0
  160. package/dist/commands/react-native/__tests__/xcode.test.js.map +1 -0
  161. package/dist/commands/sarif/__tests__/upload.test.d.ts +1 -0
  162. package/dist/commands/sarif/__tests__/upload.test.js +218 -0
  163. package/dist/commands/sarif/__tests__/upload.test.js.map +1 -0
  164. package/dist/commands/sarif/__tests__/validation.test.d.ts +1 -0
  165. package/dist/commands/sarif/__tests__/validation.test.js +19 -0
  166. package/dist/commands/sarif/__tests__/validation.test.js.map +1 -0
  167. package/dist/commands/sarif/api.js +1 -1
  168. package/dist/commands/sarif/api.js.map +1 -1
  169. package/dist/commands/sarif/interfaces.d.ts +0 -1
  170. package/dist/commands/sarif/renderer.d.ts +2 -2
  171. package/dist/commands/sarif/renderer.js +5 -5
  172. package/dist/commands/sarif/renderer.js.map +1 -1
  173. package/dist/commands/sarif/upload.d.ts +1 -1
  174. package/dist/commands/sarif/upload.js +15 -10
  175. package/dist/commands/sarif/upload.js.map +1 -1
  176. package/dist/commands/sbom/__tests__/payload.test.d.ts +1 -0
  177. package/dist/commands/sbom/__tests__/payload.test.js +306 -0
  178. package/dist/commands/sbom/__tests__/payload.test.js.map +1 -0
  179. package/dist/commands/sbom/__tests__/validation.test.d.ts +1 -0
  180. package/dist/commands/sbom/__tests__/validation.test.js +141 -0
  181. package/dist/commands/sbom/__tests__/validation.test.js.map +1 -0
  182. package/dist/commands/sbom/json-schema/spdx/spdx.schema.json +428 -198
  183. package/dist/commands/sbom/language.js +5 -1
  184. package/dist/commands/sbom/language.js.map +1 -1
  185. package/dist/commands/sbom/renderer.d.ts +2 -2
  186. package/dist/commands/sbom/renderer.js +7 -1
  187. package/dist/commands/sbom/renderer.js.map +1 -1
  188. package/dist/commands/sbom/upload.d.ts +1 -1
  189. package/dist/commands/sbom/upload.js +11 -4
  190. package/dist/commands/sbom/upload.js.map +1 -1
  191. package/dist/commands/sbom/validation.d.ts +5 -0
  192. package/dist/commands/sbom/validation.js +23 -10
  193. package/dist/commands/sbom/validation.js.map +1 -1
  194. package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +1 -0
  195. package/dist/commands/sourcemaps/__tests__/upload.test.js +270 -0
  196. package/dist/commands/sourcemaps/__tests__/upload.test.js.map +1 -0
  197. package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +1 -0
  198. package/dist/commands/sourcemaps/__tests__/utils.test.js +31 -0
  199. package/dist/commands/sourcemaps/__tests__/utils.test.js.map +1 -0
  200. package/dist/commands/sourcemaps/upload.d.ts +1 -0
  201. package/dist/commands/sourcemaps/upload.js +6 -2
  202. package/dist/commands/sourcemaps/upload.js.map +1 -1
  203. package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +1 -0
  204. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +210 -0
  205. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +1 -0
  206. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +6 -0
  207. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +45 -0
  208. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +1 -0
  209. package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +5 -0
  210. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +19 -0
  211. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +1 -0
  212. package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +1 -0
  213. package/dist/commands/stepfunctions/__tests__/helpers.test.js +501 -0
  214. package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +1 -0
  215. package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +1 -0
  216. package/dist/commands/stepfunctions/__tests__/instrument.test.js +431 -0
  217. package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +1 -0
  218. package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +1 -0
  219. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +166 -0
  220. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +1 -0
  221. package/dist/commands/synthetics/__tests__/api.test.d.ts +1 -0
  222. package/dist/commands/synthetics/__tests__/api.test.js +416 -0
  223. package/dist/commands/synthetics/__tests__/api.test.js.map +1 -0
  224. package/dist/commands/synthetics/__tests__/batch.test.d.ts +1 -0
  225. package/dist/commands/synthetics/__tests__/batch.test.js +906 -0
  226. package/dist/commands/synthetics/__tests__/batch.test.js.map +1 -0
  227. package/dist/commands/synthetics/__tests__/cli.test.d.ts +1 -0
  228. package/dist/commands/synthetics/__tests__/cli.test.js +1371 -0
  229. package/dist/commands/synthetics/__tests__/cli.test.js.map +1 -0
  230. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.d.ts +1 -0
  231. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js +112 -0
  232. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js.map +1 -0
  233. package/dist/commands/synthetics/__tests__/fixtures.d.ts +123 -0
  234. package/dist/commands/synthetics/__tests__/fixtures.js +493 -0
  235. package/dist/commands/synthetics/__tests__/fixtures.js.map +1 -0
  236. package/dist/commands/synthetics/__tests__/import-tests-lib.test.d.ts +1 -0
  237. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js +186 -0
  238. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js.map +1 -0
  239. package/dist/commands/synthetics/__tests__/mobile.test.d.ts +1 -0
  240. package/dist/commands/synthetics/__tests__/mobile.test.js +376 -0
  241. package/dist/commands/synthetics/__tests__/mobile.test.js.map +1 -0
  242. package/dist/commands/synthetics/__tests__/multilocator.test.d.ts +1 -0
  243. package/dist/commands/synthetics/__tests__/multilocator.test.js +132 -0
  244. package/dist/commands/synthetics/__tests__/multilocator.test.js.map +1 -0
  245. package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +1 -0
  246. package/dist/commands/synthetics/__tests__/reporters/default.test.js +410 -0
  247. package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +1 -0
  248. package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +1 -0
  249. package/dist/commands/synthetics/__tests__/reporters/junit.test.js +354 -0
  250. package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +1 -0
  251. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +1 -0
  252. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +232 -0
  253. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +1 -0
  254. package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +1 -0
  255. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +698 -0
  256. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +1 -0
  257. package/dist/commands/synthetics/__tests__/test.test.d.ts +1 -0
  258. package/dist/commands/synthetics/__tests__/test.test.js +269 -0
  259. package/dist/commands/synthetics/__tests__/test.test.js.map +1 -0
  260. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +1 -0
  261. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +21 -0
  262. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +1 -0
  263. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +1 -0
  264. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +80 -0
  265. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +1 -0
  266. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +1 -0
  267. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +109 -0
  268. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +1 -0
  269. package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +1 -0
  270. package/dist/commands/synthetics/__tests__/utils/internal.test.js +161 -0
  271. package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +1 -0
  272. package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +1 -0
  273. package/dist/commands/synthetics/__tests__/utils/public.test.js +575 -0
  274. package/dist/commands/synthetics/__tests__/utils/public.test.js.map +1 -0
  275. package/dist/commands/synthetics/api.d.ts +4 -2
  276. package/dist/commands/synthetics/api.js +20 -1
  277. package/dist/commands/synthetics/api.js.map +1 -1
  278. package/dist/commands/synthetics/batch.d.ts +4 -2
  279. package/dist/commands/synthetics/batch.js +65 -7
  280. package/dist/commands/synthetics/batch.js.map +1 -1
  281. package/dist/commands/synthetics/cli.js +3 -1
  282. package/dist/commands/synthetics/cli.js.map +1 -1
  283. package/dist/commands/synthetics/deploy-tests-command.d.ts +22 -0
  284. package/dist/commands/synthetics/deploy-tests-command.js +150 -0
  285. package/dist/commands/synthetics/deploy-tests-command.js.map +1 -0
  286. package/dist/commands/synthetics/deploy-tests-lib.d.ts +2 -0
  287. package/dist/commands/synthetics/deploy-tests-lib.js +72 -0
  288. package/dist/commands/synthetics/deploy-tests-lib.js.map +1 -0
  289. package/dist/commands/synthetics/errors.d.ts +1 -1
  290. package/dist/commands/synthetics/errors.js +1 -0
  291. package/dist/commands/synthetics/errors.js.map +1 -1
  292. package/dist/commands/synthetics/import-tests-command.d.ts +22 -0
  293. package/dist/commands/synthetics/import-tests-command.js +142 -0
  294. package/dist/commands/synthetics/import-tests-command.js.map +1 -0
  295. package/dist/commands/synthetics/import-tests-lib.d.ts +2 -0
  296. package/dist/commands/synthetics/import-tests-lib.js +71 -0
  297. package/dist/commands/synthetics/import-tests-lib.js.map +1 -0
  298. package/dist/commands/synthetics/interfaces.d.ts +74 -28
  299. package/dist/commands/synthetics/interfaces.js.map +1 -1
  300. package/dist/commands/synthetics/local-test-definition.d.ts +2 -0
  301. package/dist/commands/synthetics/local-test-definition.js +16 -0
  302. package/dist/commands/synthetics/local-test-definition.js.map +1 -0
  303. package/dist/commands/synthetics/mobile.js +2 -2
  304. package/dist/commands/synthetics/mobile.js.map +1 -1
  305. package/dist/commands/synthetics/multilocator.d.ts +3 -0
  306. package/dist/commands/synthetics/multilocator.js +98 -0
  307. package/dist/commands/synthetics/multilocator.js.map +1 -0
  308. package/dist/commands/synthetics/reporters/junit.d.ts +1 -2
  309. package/dist/commands/synthetics/reporters/junit.js +5 -6
  310. package/dist/commands/synthetics/reporters/junit.js.map +1 -1
  311. package/dist/commands/synthetics/run-tests-command.d.ts +0 -9
  312. package/dist/commands/synthetics/run-tests-command.js +22 -64
  313. package/dist/commands/synthetics/run-tests-command.js.map +1 -1
  314. package/dist/commands/synthetics/run-tests-lib.js +15 -12
  315. package/dist/commands/synthetics/run-tests-lib.js.map +1 -1
  316. package/dist/commands/synthetics/test.d.ts +10 -19
  317. package/dist/commands/synthetics/test.js +93 -13
  318. package/dist/commands/synthetics/test.js.map +1 -1
  319. package/dist/commands/synthetics/tunnel/tunnel.js +2 -2
  320. package/dist/commands/synthetics/tunnel/tunnel.js.map +1 -1
  321. package/dist/commands/synthetics/utils/internal.d.ts +3 -1
  322. package/dist/commands/synthetics/utils/internal.js +18 -8
  323. package/dist/commands/synthetics/utils/internal.js.map +1 -1
  324. package/dist/commands/synthetics/utils/public.d.ts +5 -26
  325. package/dist/commands/synthetics/utils/public.js +13 -248
  326. package/dist/commands/synthetics/utils/public.js.map +1 -1
  327. package/dist/commands/tag/__tests__/tag.test.d.ts +1 -0
  328. package/dist/commands/tag/__tests__/tag.test.js +85 -0
  329. package/dist/commands/tag/__tests__/tag.test.js.map +1 -0
  330. package/dist/commands/trace/__tests__/trace.test.d.ts +1 -0
  331. package/dist/commands/trace/__tests__/trace.test.js +145 -0
  332. package/dist/commands/trace/__tests__/trace.test.js.map +1 -0
  333. package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +1 -0
  334. package/dist/commands/unity-symbols/__tests__/upload.test.js +369 -0
  335. package/dist/commands/unity-symbols/__tests__/upload.test.js.map +1 -0
  336. package/dist/commands/unity-symbols/upload.js +2 -2
  337. package/dist/commands/unity-symbols/upload.js.map +1 -1
  338. package/dist/helpers/__tests__/app.test.d.ts +1 -0
  339. package/dist/helpers/__tests__/app.test.js +31 -0
  340. package/dist/helpers/__tests__/app.test.js.map +1 -0
  341. package/dist/helpers/__tests__/ci.test.d.ts +1 -0
  342. package/dist/helpers/__tests__/ci.test.js +295 -0
  343. package/dist/helpers/__tests__/ci.test.js.map +1 -0
  344. package/dist/helpers/__tests__/env.test.d.ts +1 -0
  345. package/dist/helpers/__tests__/env.test.js +74 -0
  346. package/dist/helpers/__tests__/env.test.js.map +1 -0
  347. package/dist/helpers/__tests__/fips.test.d.ts +1 -0
  348. package/dist/helpers/__tests__/fips.test.js +30 -0
  349. package/dist/helpers/__tests__/fips.test.js.map +1 -0
  350. package/dist/helpers/__tests__/fixtures.d.ts +41 -0
  351. package/dist/helpers/__tests__/fixtures.js +80 -0
  352. package/dist/helpers/__tests__/fixtures.js.map +1 -0
  353. package/dist/helpers/__tests__/flare.test.d.ts +1 -0
  354. package/dist/helpers/__tests__/flare.test.js +226 -0
  355. package/dist/helpers/__tests__/flare.test.js.map +1 -0
  356. package/dist/helpers/__tests__/fs.test.d.ts +1 -0
  357. package/dist/helpers/__tests__/fs.test.js +189 -0
  358. package/dist/helpers/__tests__/fs.test.js.map +1 -0
  359. package/dist/helpers/__tests__/id.test.d.ts +1 -0
  360. package/dist/helpers/__tests__/id.test.js +24 -0
  361. package/dist/helpers/__tests__/id.test.js.map +1 -0
  362. package/dist/helpers/__tests__/plist.test.d.ts +1 -0
  363. package/dist/helpers/__tests__/plist.test.js +43 -0
  364. package/dist/helpers/__tests__/plist.test.js.map +1 -0
  365. package/dist/helpers/__tests__/prompt.test.d.ts +1 -0
  366. package/dist/helpers/__tests__/prompt.test.js +71 -0
  367. package/dist/helpers/__tests__/prompt.test.js.map +1 -0
  368. package/dist/helpers/__tests__/retry.test.d.ts +1 -0
  369. package/dist/helpers/__tests__/retry.test.js +99 -0
  370. package/dist/helpers/__tests__/retry.test.js.map +1 -0
  371. package/dist/helpers/__tests__/tags.test.d.ts +1 -0
  372. package/dist/helpers/__tests__/tags.test.js +303 -0
  373. package/dist/helpers/__tests__/tags.test.js.map +1 -0
  374. package/dist/helpers/__tests__/upload.test.d.ts +1 -0
  375. package/dist/helpers/__tests__/upload.test.js +231 -0
  376. package/dist/helpers/__tests__/upload.test.js.map +1 -0
  377. package/dist/helpers/__tests__/user-provided-git.test.d.ts +1 -0
  378. package/dist/helpers/__tests__/user-provided-git.test.js +119 -0
  379. package/dist/helpers/__tests__/user-provided-git.test.js.map +1 -0
  380. package/dist/helpers/__tests__/utils.test.d.ts +1 -0
  381. package/dist/helpers/__tests__/utils.test.js +429 -0
  382. package/dist/helpers/__tests__/utils.test.js.map +1 -0
  383. package/dist/helpers/__tests__/validation.test.d.ts +1 -0
  384. package/dist/helpers/__tests__/validation.test.js +25 -0
  385. package/dist/helpers/__tests__/validation.test.js.map +1 -0
  386. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +1 -0
  387. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +103 -0
  388. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +1 -0
  389. package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +1 -0
  390. package/dist/helpers/git/__tests__/format-git-span-data.test.js +121 -0
  391. package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +1 -0
  392. package/dist/helpers/git/__tests__/get-git-data.test.d.ts +1 -0
  393. package/dist/helpers/git/__tests__/get-git-data.test.js +72 -0
  394. package/dist/helpers/git/__tests__/get-git-data.test.js.map +1 -0
  395. package/dist/helpers/id.js.map +1 -0
  396. package/dist/helpers/tags.d.ts +1 -4
  397. package/dist/helpers/tags.js +2 -6
  398. package/dist/helpers/tags.js.map +1 -1
  399. package/dist/helpers/utils.d.ts +0 -4
  400. package/dist/helpers/utils.js +1 -21
  401. package/dist/helpers/utils.js.map +1 -1
  402. package/package.json +16 -17
  403. package/dist/commands/junit/id.js.map +0 -1
  404. package/dist/commands/synthetics/compatibility.d.ts +0 -7
  405. package/dist/commands/synthetics/compatibility.js +0 -83
  406. package/dist/commands/synthetics/compatibility.js.map +0 -1
  407. /package/dist/{commands/junit → helpers}/id.d.ts +0 -0
  408. /package/dist/{commands/junit → helpers}/id.js +0 -0
@@ -0,0 +1,698 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const fs_1 = __importDefault(require("fs"));
39
+ const fixtures_1 = require("../../../helpers/__tests__/fixtures");
40
+ const ciUtils = __importStar(require("../../../helpers/utils"));
41
+ const api = __importStar(require("../api"));
42
+ const batchUtils = __importStar(require("../batch"));
43
+ const errors_1 = require("../errors");
44
+ const interfaces_1 = require("../interfaces");
45
+ const default_1 = require("../reporters/default");
46
+ const junit_1 = require("../reporters/junit");
47
+ const appUploadReporterModule = __importStar(require("../reporters/mobile/app-upload"));
48
+ const runTests = __importStar(require("../run-tests-lib"));
49
+ const testUtils = __importStar(require("../test"));
50
+ const tunnel_1 = require("../tunnel");
51
+ const internalUtils = __importStar(require("../utils/internal"));
52
+ const utils = __importStar(require("../utils/public"));
53
+ const fixtures_2 = require("./fixtures");
54
+ describe('run-test', () => {
55
+ beforeEach(() => {
56
+ jest.restoreAllMocks();
57
+ jest.spyOn(ciUtils, 'getConfig').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return ({}); }));
58
+ process.env = {};
59
+ });
60
+ describe('executeTests', () => {
61
+ test('should apply config override for tests triggered by public id', () => __awaiter(void 0, void 0, void 0, function* () {
62
+ const getTestsToTriggersMock = jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
63
+ initialSummary: utils.createInitialSummary(),
64
+ overriddenTestsToTrigger: [],
65
+ tests: [],
66
+ }));
67
+ jest.spyOn(batchUtils, 'runTests').mockImplementation();
68
+ const startUrl = '{{PROTOCOL}}//myhost{{PATHNAME}}{{PARAMS}}';
69
+ const locations = ['location1', 'location2'];
70
+ const userConfigOverride = { locations, startUrl };
71
+ const apiHelper = {};
72
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({}));
73
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: userConfigOverride, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'] }))).rejects.toThrow();
74
+ expect(getTestsToTriggersMock).toHaveBeenCalledWith(apiHelper, expect.arrayContaining([
75
+ expect.objectContaining({ id: 'aaa-aaa-aaa', testOverrides: userConfigOverride }),
76
+ expect.objectContaining({ id: 'bbb-bbb-bbb', testOverrides: userConfigOverride }),
77
+ ]), expect.anything(), false, false, false);
78
+ }));
79
+ test('Use appropriate list of locations for tests triggered by public id', () => __awaiter(void 0, void 0, void 0, function* () {
80
+ const getTestsToTriggersMock = jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
81
+ initialSummary: utils.createInitialSummary(),
82
+ overriddenTestsToTrigger: [],
83
+ tests: [],
84
+ }));
85
+ const apiHelper = {};
86
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({}));
87
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: { locations: ['defaultTestOverrides-location-1'] }, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'] }))).rejects.toThrow(new errors_1.CiError('NO_TESTS_TO_RUN'));
88
+ expect(getTestsToTriggersMock).toHaveBeenCalledWith(apiHelper, expect.arrayContaining([
89
+ expect.objectContaining({ id: 'aaa-aaa-aaa', testOverrides: { locations: ['defaultTestOverrides-location-1'] } }),
90
+ expect.objectContaining({ id: 'bbb-bbb-bbb', testOverrides: { locations: ['defaultTestOverrides-location-1'] } }),
91
+ ]), expect.anything(), false, false, false);
92
+ }));
93
+ test('should not wait for `skipped` only tests batch results', () => __awaiter(void 0, void 0, void 0, function* () {
94
+ const getTestsToTriggersMock = jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
95
+ initialSummary: utils.createInitialSummary(),
96
+ overriddenTestsToTrigger: [],
97
+ tests: [],
98
+ }));
99
+ const apiHelper = {};
100
+ const configOverride = { executionRule: interfaces_1.ExecutionRule.SKIPPED };
101
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({}));
102
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: configOverride, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'] }))).rejects.toThrow(new errors_1.CiError('NO_TESTS_TO_RUN'));
103
+ expect(getTestsToTriggersMock).toHaveBeenCalledWith(apiHelper, expect.arrayContaining([
104
+ expect.objectContaining({ id: 'aaa-aaa-aaa', testOverrides: configOverride }),
105
+ expect.objectContaining({ id: 'bbb-bbb-bbb', testOverrides: configOverride }),
106
+ ]), expect.anything(), false, false, false);
107
+ }));
108
+ test('should not open tunnel if no test to run', () => __awaiter(void 0, void 0, void 0, function* () {
109
+ const getTestsToTriggersMock = jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
110
+ initialSummary: utils.createInitialSummary(),
111
+ overriddenTestsToTrigger: [],
112
+ tests: [],
113
+ }));
114
+ const apiHelper = {
115
+ getTunnelPresignedURL: jest.fn(),
116
+ };
117
+ const configOverride = { executionRule: interfaces_1.ExecutionRule.SKIPPED };
118
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
119
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: configOverride, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true }))).rejects.toThrow(new errors_1.CiError('NO_TESTS_TO_RUN'));
120
+ expect(getTestsToTriggersMock).toHaveBeenCalledWith(apiHelper, expect.arrayContaining([
121
+ expect.objectContaining({ id: 'aaa-aaa-aaa', testOverrides: configOverride }),
122
+ expect.objectContaining({ id: 'bbb-bbb-bbb', testOverrides: configOverride }),
123
+ ]), expect.anything(), false, false, true);
124
+ expect(apiHelper.getTunnelPresignedURL).not.toHaveBeenCalled();
125
+ }));
126
+ test('open and close tunnel for successful runs', () => __awaiter(void 0, void 0, void 0, function* () {
127
+ jest.spyOn(internalUtils, 'wait').mockImplementation(() => new Promise((res) => setTimeout(res, 10)));
128
+ const startTunnelSpy = jest
129
+ .spyOn(tunnel_1.Tunnel.prototype, 'start')
130
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return ({ host: 'host', id: 'id', privateKey: 'key' }); }));
131
+ const stopTunnelSpy = jest.spyOn(tunnel_1.Tunnel.prototype, 'stop');
132
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
133
+ initialSummary: utils.createInitialSummary(),
134
+ overriddenTestsToTrigger: [],
135
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: '123-456-789' }],
136
+ }));
137
+ jest.spyOn(batchUtils, 'runTests').mockResolvedValue(fixtures_2.mockTestTriggerResponse);
138
+ const apiHelper = {
139
+ getBatch: () => ({ results: [] }),
140
+ getTunnelPresignedURL: () => ({ url: 'url' }),
141
+ pollResults: () => [(0, fixtures_2.getApiResult)('1', (0, fixtures_2.getApiTest)())],
142
+ triggerTests: () => fixtures_2.mockTestTriggerResponse,
143
+ };
144
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
145
+ yield runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { failOnCriticalErrors: true, publicIds: ['123-456-789'], tunnel: true }));
146
+ expect(startTunnelSpy).toHaveBeenCalledTimes(1);
147
+ expect(stopTunnelSpy).toHaveBeenCalledTimes(1);
148
+ }));
149
+ const cases = [
150
+ [403, 'AUTHORIZATION_ERROR'],
151
+ [502, 'UNAVAILABLE_TEST_CONFIG'],
152
+ ];
153
+ describe.each(cases)('%s triggers %s', (status, error) => {
154
+ test(`getTestsList throws - ${status}`, () => __awaiter(void 0, void 0, void 0, function* () {
155
+ const apiHelper = {
156
+ searchTests: jest.fn(() => {
157
+ throw (0, fixtures_1.getAxiosError)(status, { message: 'Server Error' });
158
+ }),
159
+ };
160
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
161
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { testSearchQuery: 'a-search-query', tunnel: true }))).rejects.toThrow(new errors_1.CriticalError(error, 'Server Error'));
162
+ }));
163
+ test(`getTestsToTrigger throws - ${status}`, () => __awaiter(void 0, void 0, void 0, function* () {
164
+ const apiHelper = {
165
+ getTest: jest.fn(() => {
166
+ throw (0, fixtures_1.getAxiosError)(status, { errors: ['Bad Gateway'] });
167
+ }),
168
+ };
169
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
170
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { publicIds: ['aaa-aaa-aaa'], tunnel: true }))).rejects.toThrow(new errors_1.CriticalError(error, 'Failed to get test: query on https://app.datadoghq.com/example returned: "Bad Gateway"\n'));
171
+ }));
172
+ });
173
+ test('getTunnelPresignedURL throws', () => __awaiter(void 0, void 0, void 0, function* () {
174
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
175
+ initialSummary: utils.createInitialSummary(),
176
+ overriddenTestsToTrigger: [],
177
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: 'publicId' }],
178
+ }));
179
+ const apiHelper = {
180
+ getTunnelPresignedURL: jest.fn(() => {
181
+ throw (0, fixtures_1.getAxiosError)(502, { message: 'Server Error' });
182
+ }),
183
+ };
184
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
185
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true }))).rejects.toThrow(new errors_1.CriticalError('UNAVAILABLE_TUNNEL_CONFIG', 'Server Error'));
186
+ }));
187
+ test('getMobileApplicationPresignedURLs throws', () => __awaiter(void 0, void 0, void 0, function* () {
188
+ const mobileTest = (0, fixtures_2.getMobileTest)();
189
+ jest.spyOn(testUtils, 'getTestAndOverrideConfig').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () {
190
+ return Promise.resolve({
191
+ overriddenConfig: { executionRule: interfaces_1.ExecutionRule.NON_BLOCKING, public_id: mobileTest.public_id },
192
+ test: mobileTest,
193
+ });
194
+ }));
195
+ // use /dev/null to create a valid empty fs.ReadStream
196
+ const testStream = fs_1.default.createReadStream('/dev/null');
197
+ jest.spyOn(fs_1.default, 'createReadStream').mockReturnValue(testStream);
198
+ const { AppUploadReporter } = jest.requireActual('../reporters/mobile/app-upload');
199
+ jest
200
+ .spyOn(appUploadReporterModule, 'AppUploadReporter')
201
+ .mockImplementation(() => new AppUploadReporter({ stdout: { write: jest.fn() } }));
202
+ const apiHelper = {
203
+ getMobileApplicationPresignedURLs: jest.fn(() => {
204
+ throw (0, fixtures_1.getAxiosError)(502, { message: 'Server Error' });
205
+ }),
206
+ };
207
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
208
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: { mobileApplicationVersionFilePath: 'filePath' }, publicIds: [mobileTest.public_id] }))).rejects.toThrow('Failed to get presigned URL: could not query https://app.datadoghq.com/example');
209
+ }));
210
+ test('uploadMobileApplicationPart throws', () => __awaiter(void 0, void 0, void 0, function* () {
211
+ const mobileTest = (0, fixtures_2.getMobileTest)();
212
+ jest.spyOn(testUtils, 'getTestAndOverrideConfig').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () {
213
+ return Promise.resolve({
214
+ overriddenConfig: { executionRule: interfaces_1.ExecutionRule.NON_BLOCKING, public_id: mobileTest.public_id },
215
+ test: mobileTest,
216
+ });
217
+ }));
218
+ // use /dev/null to create a valid empty fs.ReadStream
219
+ const testStream = fs_1.default.createReadStream('/dev/null');
220
+ jest.spyOn(fs_1.default, 'createReadStream').mockReturnValue(testStream);
221
+ const { AppUploadReporter } = jest.requireActual('../reporters/mobile/app-upload');
222
+ jest
223
+ .spyOn(appUploadReporterModule, 'AppUploadReporter')
224
+ .mockImplementation(() => new AppUploadReporter({ stdout: { write: jest.fn() } }));
225
+ jest.spyOn(fs_1.default.promises, 'readFile').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return Buffer.from('aa'); }));
226
+ const apiHelper = {
227
+ getMobileApplicationPresignedURLs: jest.fn(() => fixtures_2.MOBILE_PRESIGNED_URLS_PAYLOAD),
228
+ uploadMobileApplicationPart: jest.fn(() => {
229
+ throw (0, fixtures_1.getAxiosError)(502, { message: 'Server Error' });
230
+ }),
231
+ };
232
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
233
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides: { mobileApplicationVersionFilePath: 'filePath' }, publicIds: [mobileTest.public_id] }))).rejects.toThrow('Failed to upload mobile application: could not query https://app.datadoghq.com/example');
234
+ }));
235
+ test('runTests throws', () => __awaiter(void 0, void 0, void 0, function* () {
236
+ jest
237
+ .spyOn(tunnel_1.Tunnel.prototype, 'start')
238
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return ({ host: 'host', id: 'id', privateKey: 'key' }); }));
239
+ const stopTunnelSpy = jest.spyOn(tunnel_1.Tunnel.prototype, 'stop');
240
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
241
+ initialSummary: utils.createInitialSummary(),
242
+ overriddenTestsToTrigger: [],
243
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: 'publicId' }],
244
+ }));
245
+ const apiHelper = {
246
+ getTunnelPresignedURL: () => ({ url: 'url' }),
247
+ triggerTests: jest.fn(() => {
248
+ throw (0, fixtures_1.getAxiosError)(502, { errors: ['Bad Gateway'] });
249
+ }),
250
+ };
251
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
252
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true }))).rejects.toThrow(new errors_1.CriticalError('TRIGGER_TESTS_FAILED', '[] Failed to trigger tests: query on https://app.datadoghq.com/example returned: "Bad Gateway"\n'));
253
+ expect(stopTunnelSpy).toHaveBeenCalledTimes(1);
254
+ }));
255
+ test('waitForResults throws', () => __awaiter(void 0, void 0, void 0, function* () {
256
+ const location = {
257
+ display_name: 'us1',
258
+ id: 1,
259
+ is_active: true,
260
+ name: 'us1',
261
+ region: 'us1',
262
+ };
263
+ jest
264
+ .spyOn(tunnel_1.Tunnel.prototype, 'start')
265
+ .mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () { return ({ host: 'host', id: 'id', privateKey: 'key' }); }));
266
+ const stopTunnelSpy = jest.spyOn(tunnel_1.Tunnel.prototype, 'stop');
267
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
268
+ initialSummary: utils.createInitialSummary(),
269
+ overriddenTestsToTrigger: [],
270
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: 'publicId' }],
271
+ }));
272
+ jest.spyOn(batchUtils, 'runTests').mockReturnValue(Promise.resolve({
273
+ batch_id: 'bid',
274
+ locations: [location],
275
+ }));
276
+ const apiHelper = {
277
+ getBatch: () => ({ results: [] }),
278
+ getTunnelPresignedURL: () => ({ url: 'url' }),
279
+ pollResults: jest.fn(() => {
280
+ throw (0, fixtures_1.getAxiosError)(502, { errors: ['Bad Gateway'] });
281
+ }),
282
+ };
283
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
284
+ yield expect(runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { failOnCriticalErrors: true, publicIds: ['aaa-aaa-aaa', 'bbb-bbb-bbb'], tunnel: true }))).rejects.toThrow(new errors_1.CriticalError('POLL_RESULTS_FAILED', 'Failed to poll results: query on https://app.datadoghq.com/example returned: "Bad Gateway"\n'));
285
+ expect(stopTunnelSpy).toHaveBeenCalledTimes(1);
286
+ }));
287
+ test('log when selective rerun is rate-limited', () => __awaiter(void 0, void 0, void 0, function* () {
288
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
289
+ initialSummary: utils.createInitialSummary(),
290
+ overriddenTestsToTrigger: [],
291
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: 'aaa-aaa-aaa' }],
292
+ }));
293
+ jest.spyOn(batchUtils, 'runTests').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () {
294
+ return ({
295
+ batch_id: 'bid',
296
+ locations: [],
297
+ selective_rerun_rate_limited: true,
298
+ });
299
+ }));
300
+ const apiHelper = {
301
+ getBatch: () => ({ results: [] }),
302
+ getTunnelPresignedURL: () => ({ url: 'url' }),
303
+ pollResults: () => [(0, fixtures_2.getApiResult)('1', (0, fixtures_2.getApiTest)())],
304
+ triggerTests: () => fixtures_2.mockTestTriggerResponse,
305
+ };
306
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
307
+ yield runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { publicIds: ['aaa-aaa-aaa'], selectiveRerun: true }));
308
+ expect(fixtures_2.mockReporter.error).toHaveBeenCalledWith('The selective rerun feature was rate-limited. All tests will be re-run.\n\n');
309
+ }));
310
+ test('selective rerun defaults to undefined', () => __awaiter(void 0, void 0, void 0, function* () {
311
+ jest.spyOn(testUtils, 'getTestsToTrigger').mockReturnValue(Promise.resolve({
312
+ initialSummary: utils.createInitialSummary(),
313
+ overriddenTestsToTrigger: [],
314
+ tests: [{ options: { ci: { executionRule: interfaces_1.ExecutionRule.BLOCKING } }, public_id: 'aaa-aaa-aaa' }],
315
+ }));
316
+ const triggerTestsSpy = jest.fn(() => fixtures_2.mockTestTriggerResponse);
317
+ const apiHelper = {
318
+ getBatch: () => ({ results: [] }),
319
+ getTunnelPresignedURL: () => ({ url: 'url' }),
320
+ pollResults: () => [(0, fixtures_2.getApiResult)('1', (0, fixtures_2.getApiTest)())],
321
+ triggerTests: triggerTestsSpy,
322
+ };
323
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => apiHelper);
324
+ yield runTests.executeTests(fixtures_2.mockReporter, Object.assign(Object.assign({}, fixtures_2.ciConfig), { publicIds: ['aaa-aaa-aaa'] }));
325
+ expect(triggerTestsSpy).toHaveBeenCalledWith({
326
+ tests: [],
327
+ options: {
328
+ batch_timeout: fixtures_2.ciConfig.batchTimeout,
329
+ selective_rerun: undefined,
330
+ },
331
+ });
332
+ }));
333
+ });
334
+ describe('executeWithDetails', () => {
335
+ beforeEach(() => {
336
+ jest.restoreAllMocks();
337
+ jest.spyOn(api, 'getApiHelper').mockImplementation(() => ({
338
+ getSyntheticsOrgSettings: () => ({
339
+ onDemandConcurrencyCap: 1,
340
+ }),
341
+ }));
342
+ jest.spyOn(runTests, 'executeTests').mockReturnValue(Promise.resolve({ results: [], summary: {} }));
343
+ jest.spyOn(utils, 'renderResults').mockImplementation(jest.fn());
344
+ });
345
+ test('should call executeTests and renderResults', () => __awaiter(void 0, void 0, void 0, function* () {
346
+ yield runTests.executeWithDetails({}, {});
347
+ expect(runTests.executeTests).toHaveBeenCalled();
348
+ expect(utils.renderResults).toHaveBeenCalled();
349
+ }));
350
+ test('should extend config', () => __awaiter(void 0, void 0, void 0, function* () {
351
+ const runConfig = { apiKey: 'apiKey', appKey: 'appKey' };
352
+ yield runTests.executeWithDetails(runConfig, {});
353
+ expect(runTests.executeTests).toHaveBeenCalledWith(expect.anything(), expect.objectContaining(runConfig), undefined);
354
+ }));
355
+ test('should bypass files if suite is passed', () => __awaiter(void 0, void 0, void 0, function* () {
356
+ const suites = [{ content: { tests: [] } }];
357
+ yield runTests.executeWithDetails({}, { suites });
358
+ expect(runTests.executeTests).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ files: [] }), suites);
359
+ }));
360
+ test('should return values returned by executeTests, and an exitCode', () => __awaiter(void 0, void 0, void 0, function* () {
361
+ const returnValue = yield runTests.executeWithDetails({}, {});
362
+ expect(returnValue.results).toBeDefined();
363
+ expect(returnValue.summary).toBeDefined();
364
+ expect(returnValue.exitCode).toBeDefined();
365
+ }));
366
+ describe('reporters', () => {
367
+ beforeEach(() => {
368
+ jest.spyOn(utils, 'getReporter').mockImplementation(jest.fn());
369
+ });
370
+ test('should use default reporter with empty config', () => __awaiter(void 0, void 0, void 0, function* () {
371
+ yield runTests.executeWithDetails({}, {});
372
+ expect(utils.getReporter).toHaveBeenCalledWith(expect.arrayContaining([expect.any(default_1.DefaultReporter)]));
373
+ }));
374
+ test('should use custom reporters', () => __awaiter(void 0, void 0, void 0, function* () {
375
+ const CustomReporter = {};
376
+ yield runTests.executeWithDetails({}, { reporters: ['junit', CustomReporter] });
377
+ expect(utils.getReporter).toHaveBeenCalledWith(expect.arrayContaining([expect.any(junit_1.JUnitReporter), CustomReporter]));
378
+ }));
379
+ });
380
+ });
381
+ describe('execute', () => {
382
+ beforeEach(() => {
383
+ jest.restoreAllMocks();
384
+ jest
385
+ .spyOn(runTests, 'executeWithDetails')
386
+ .mockReturnValue(Promise.resolve({ results: [], summary: {}, exitCode: 0 }));
387
+ });
388
+ test('should call executeWithDetails', () => __awaiter(void 0, void 0, void 0, function* () {
389
+ yield runTests.execute({}, {});
390
+ expect(runTests.executeWithDetails).toHaveBeenCalled();
391
+ }));
392
+ test('should return the exitCode returned by executeWithDetails', () => __awaiter(void 0, void 0, void 0, function* () {
393
+ const returnValue = yield runTests.execute({}, {});
394
+ expect(returnValue).toBe(0);
395
+ }));
396
+ });
397
+ describe('getTriggerConfigs', () => {
398
+ beforeEach(() => {
399
+ jest.restoreAllMocks();
400
+ });
401
+ const startUrl = 'fakeUrl';
402
+ const locations = ['aws:ap-northeast-1'];
403
+ const conf1 = {
404
+ tests: [{ testOverrides: { deviceIds: ['chrome.laptop_large'] }, id: 'abc-def-ghi' }],
405
+ };
406
+ const conf2 = {
407
+ tests: [{ testOverrides: { startUrl: 'someOtherFakeUrl' }, id: 'jkl-mno-pqr' }],
408
+ };
409
+ const fakeSuites = [
410
+ {
411
+ content: conf1,
412
+ name: 'Suite 1',
413
+ },
414
+ {
415
+ content: conf2,
416
+ name: 'Suite 2',
417
+ },
418
+ ];
419
+ const fakeApi = {
420
+ searchTests: () => ({
421
+ tests: [
422
+ {
423
+ public_id: 'stu-vwx-yza',
424
+ },
425
+ ],
426
+ }),
427
+ };
428
+ test('should extend global config and execute all tests from test config files when no clue what to run', () => __awaiter(void 0, void 0, void 0, function* () {
429
+ const getSuitesMock = jest.spyOn(utils, 'getSuites').mockResolvedValue(fakeSuites);
430
+ const defaultTestOverrides = { locations, startUrl };
431
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides }), fixtures_2.mockReporter)).resolves.toEqual([
432
+ {
433
+ testOverrides: { deviceIds: ['chrome.laptop_large'], startUrl, locations },
434
+ id: 'abc-def-ghi',
435
+ suite: 'Suite 1',
436
+ },
437
+ {
438
+ testOverrides: { startUrl: 'someOtherFakeUrl', locations },
439
+ id: 'jkl-mno-pqr',
440
+ suite: 'Suite 2',
441
+ },
442
+ ]);
443
+ expect(getSuitesMock).toHaveBeenCalledTimes(1);
444
+ expect(getSuitesMock).toHaveBeenCalledWith('{,!(node_modules)/**/}*.synthetics.json', fixtures_2.mockReporter);
445
+ }));
446
+ test('should override and execute only publicIds that were defined in the global config', () => __awaiter(void 0, void 0, void 0, function* () {
447
+ const getSuitesMock = jest.spyOn(utils, 'getSuites');
448
+ const defaultTestOverrides = { locations, startUrl };
449
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, publicIds: ['abc-def-ghi', '123-456-789'] }), fixtures_2.mockReporter)).resolves.toEqual([
450
+ {
451
+ testOverrides: { startUrl, locations },
452
+ id: 'abc-def-ghi',
453
+ },
454
+ {
455
+ testOverrides: { startUrl, locations },
456
+ id: '123-456-789',
457
+ },
458
+ ]);
459
+ expect(getSuitesMock).toHaveBeenCalledTimes(0);
460
+ }));
461
+ test('should override and execute only publicIds that were defined in the global config and use given globs', () => __awaiter(void 0, void 0, void 0, function* () {
462
+ const getSuitesMock = jest.spyOn(utils, 'getSuites').mockResolvedValue(fakeSuites);
463
+ const defaultTestOverrides = { locations, startUrl };
464
+ const files = ['glob'];
465
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides,
466
+ files, publicIds: ['abc-def-ghi'] }), fixtures_2.mockReporter)).resolves.toEqual([
467
+ {
468
+ testOverrides: { startUrl, locations, deviceIds: ['chrome.laptop_large'] },
469
+ id: 'abc-def-ghi',
470
+ suite: 'Suite 1',
471
+ },
472
+ ]);
473
+ expect(getSuitesMock).toHaveBeenCalledTimes(1);
474
+ expect(getSuitesMock).toHaveBeenCalledWith('glob', fixtures_2.mockReporter);
475
+ }));
476
+ test('should search tests and extend global config', () => __awaiter(void 0, void 0, void 0, function* () {
477
+ const getSuitesMock = jest.spyOn(utils, 'getSuites');
478
+ const defaultTestOverrides = { locations, startUrl };
479
+ const searchQuery = 'fake search';
480
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, testSearchQuery: searchQuery }), fixtures_2.mockReporter)).resolves.toEqual([
481
+ {
482
+ testOverrides: { locations, startUrl },
483
+ id: 'stu-vwx-yza',
484
+ suite: 'Query: fake search',
485
+ },
486
+ ]);
487
+ expect(getSuitesMock).toHaveBeenCalledTimes(0);
488
+ }));
489
+ test('should not use testSearchQuery if global config has defined publicIds', () => __awaiter(void 0, void 0, void 0, function* () {
490
+ const defaultTestOverrides = { startUrl };
491
+ const searchQuery = 'fake search';
492
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, publicIds: ['abc-def-ghi'], testSearchQuery: searchQuery }), fixtures_2.mockReporter)).resolves.toEqual([
493
+ {
494
+ testOverrides: { startUrl },
495
+ id: 'abc-def-ghi',
496
+ },
497
+ ]);
498
+ }));
499
+ test('should search tests with testSearchQuery and use given globs', () => __awaiter(void 0, void 0, void 0, function* () {
500
+ const getSuitesMock = jest.spyOn(utils, 'getSuites').mockResolvedValue(fakeSuites);
501
+ const defaultTestOverrides = { startUrl };
502
+ const searchQuery = 'fake search';
503
+ const files = ['glob'];
504
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides,
505
+ files, testSearchQuery: searchQuery }), fixtures_2.mockReporter)).resolves.toEqual([
506
+ {
507
+ testOverrides: { startUrl },
508
+ id: 'stu-vwx-yza',
509
+ suite: 'Query: fake search',
510
+ },
511
+ ]);
512
+ expect(getSuitesMock).toHaveBeenCalledTimes(1);
513
+ expect(getSuitesMock).toHaveBeenCalledWith('glob', fixtures_2.mockReporter);
514
+ }));
515
+ test('should use given globs to get tests list', () => __awaiter(void 0, void 0, void 0, function* () {
516
+ const getSuitesMock = jest.spyOn(utils, 'getSuites').mockResolvedValue(fakeSuites);
517
+ const defaultTestOverrides = { startUrl };
518
+ const files = ['new glob', 'another one'];
519
+ yield runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, files }), fixtures_2.mockReporter);
520
+ expect(getSuitesMock).toHaveBeenCalledTimes(2);
521
+ expect(getSuitesMock).toHaveBeenCalledWith('new glob', fixtures_2.mockReporter);
522
+ expect(getSuitesMock).toHaveBeenCalledWith('another one', fixtures_2.mockReporter);
523
+ }));
524
+ test('should return tests from provided suites with overrides', () => __awaiter(void 0, void 0, void 0, function* () {
525
+ const getSuitesMock = jest.spyOn(utils, 'getSuites');
526
+ const defaultTestOverrides = { startUrl };
527
+ const files = [];
528
+ const tests = yield runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, files }), fixtures_2.mockReporter, fakeSuites);
529
+ expect(tests).toEqual([
530
+ {
531
+ testOverrides: { deviceIds: ['chrome.laptop_large'], startUrl },
532
+ id: conf1.tests[0].id,
533
+ suite: fakeSuites[0].name,
534
+ },
535
+ { testOverrides: { startUrl: 'someOtherFakeUrl' }, id: conf2.tests[0].id, suite: fakeSuites[1].name },
536
+ ]);
537
+ expect(getSuitesMock).toHaveBeenCalledTimes(0);
538
+ }));
539
+ test('should merge getSuites and user provided suites', () => __awaiter(void 0, void 0, void 0, function* () {
540
+ const userSuites = [fakeSuites[0]];
541
+ const globSuites = [fakeSuites[1]];
542
+ const getSuitesMock = jest.spyOn(utils, 'getSuites').mockResolvedValue(globSuites);
543
+ const defaultTestOverrides = { startUrl };
544
+ const files = ['glob'];
545
+ const tests = yield runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides, files }), fixtures_2.mockReporter, userSuites);
546
+ expect(tests).toEqual([
547
+ {
548
+ testOverrides: { deviceIds: ['chrome.laptop_large'], startUrl },
549
+ id: conf1.tests[0].id,
550
+ suite: fakeSuites[0].name,
551
+ },
552
+ { testOverrides: { startUrl: 'someOtherFakeUrl' }, id: conf2.tests[0].id, suite: fakeSuites[1].name },
553
+ ]);
554
+ expect(getSuitesMock).toHaveBeenCalledTimes(1);
555
+ expect(getSuitesMock).toHaveBeenCalledWith('glob', fixtures_2.mockReporter);
556
+ }));
557
+ test('should handle test configurations with the same test ID correctly', () => __awaiter(void 0, void 0, void 0, function* () {
558
+ const suite = {
559
+ name: 'Suite with duplicate IDs',
560
+ content: {
561
+ tests: [
562
+ {
563
+ id: 'abc-abc-abc',
564
+ testOverrides: {
565
+ allowInsecureCertificates: true,
566
+ basicAuth: { username: 'test', password: 'test' },
567
+ body: '{"fakeContent":true}',
568
+ bodyType: 'application/json',
569
+ cookies: 'name1=value1;name2=value2;',
570
+ setCookies: 'name1=value1 \n name2=value2; Secure',
571
+ defaultStepTimeout: 15,
572
+ deviceIds: ['chrome.laptop_large'],
573
+ executionRule: interfaces_1.ExecutionRule.NON_BLOCKING,
574
+ followRedirects: true,
575
+ headers: { NEW_HEADER: 'NEW VALUE' },
576
+ locations: ['aws:us-east-1'],
577
+ mobileApplicationVersion: '01234567-8888-9999-abcd-efffffffffff',
578
+ mobileApplicationVersionFilePath: 'path/to/application.apk',
579
+ retry: { count: 2, interval: 300 },
580
+ testTimeout: 300,
581
+ variables: { MY_VARIABLE: 'new title' },
582
+ },
583
+ },
584
+ {
585
+ id: 'abc-abc-abc',
586
+ testOverrides: {
587
+ executionRule: interfaces_1.ExecutionRule.SKIPPED,
588
+ },
589
+ },
590
+ ],
591
+ },
592
+ };
593
+ jest.spyOn(utils, 'getSuites').mockResolvedValue([suite]);
594
+ const defaultTestOverrides = { locations: ['aws:us-east-1'], startUrl: 'fakeUrl' };
595
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { defaultTestOverrides }), fixtures_2.mockReporter)).resolves.toEqual([
596
+ {
597
+ testOverrides: {
598
+ allowInsecureCertificates: true,
599
+ basicAuth: { username: 'test', password: 'test' },
600
+ body: '{"fakeContent":true}',
601
+ bodyType: 'application/json',
602
+ cookies: 'name1=value1;name2=value2;',
603
+ setCookies: 'name1=value1 \n name2=value2; Secure',
604
+ defaultStepTimeout: 15,
605
+ deviceIds: ['chrome.laptop_large'],
606
+ executionRule: 'non_blocking',
607
+ followRedirects: true,
608
+ headers: { NEW_HEADER: 'NEW VALUE' },
609
+ locations: ['aws:us-east-1'],
610
+ mobileApplicationVersion: '01234567-8888-9999-abcd-efffffffffff',
611
+ mobileApplicationVersionFilePath: 'path/to/application.apk',
612
+ retry: { count: 2, interval: 300 },
613
+ testTimeout: 300,
614
+ variables: { MY_VARIABLE: 'new title' },
615
+ startUrl: 'fakeUrl',
616
+ },
617
+ id: 'abc-abc-abc',
618
+ suite: 'Suite with duplicate IDs',
619
+ },
620
+ {
621
+ testOverrides: {
622
+ executionRule: 'skipped',
623
+ startUrl: 'fakeUrl',
624
+ locations: ['aws:us-east-1'],
625
+ },
626
+ id: 'abc-abc-abc',
627
+ suite: 'Suite with duplicate IDs',
628
+ },
629
+ ]);
630
+ }));
631
+ test('should handle local test definitions', () => __awaiter(void 0, void 0, void 0, function* () {
632
+ const localTestDefinition = (0, fixtures_2.getApiTest)('bbb-bbb-bbb');
633
+ const suite = {
634
+ name: 'Suite with local test definitions',
635
+ content: {
636
+ tests: [
637
+ {
638
+ id: 'aaa-aaa-aaa',
639
+ testOverrides: {
640
+ startUrl: 'fakeUrl',
641
+ },
642
+ },
643
+ {
644
+ localTestDefinition,
645
+ testOverrides: {
646
+ startUrl: 'fakeUrl',
647
+ },
648
+ },
649
+ ],
650
+ },
651
+ };
652
+ jest.spyOn(utils, 'getSuites').mockResolvedValue([suite]);
653
+ yield expect(runTests.getTriggerConfigs(fakeApi, fixtures_2.ciConfig, fixtures_2.mockReporter)).resolves.toEqual([
654
+ {
655
+ id: 'aaa-aaa-aaa',
656
+ suite: 'Suite with local test definitions',
657
+ testOverrides: { startUrl: 'fakeUrl' },
658
+ },
659
+ {
660
+ localTestDefinition,
661
+ suite: 'Suite with local test definitions',
662
+ testOverrides: { startUrl: 'fakeUrl' },
663
+ },
664
+ ]);
665
+ }));
666
+ test('should handle local test definitions selected with publicIds', () => __awaiter(void 0, void 0, void 0, function* () {
667
+ const localTestDefinition = (0, fixtures_2.getApiTest)('bbb-bbb-bbb');
668
+ const suite = {
669
+ name: 'Suite with local test definitions',
670
+ content: {
671
+ tests: [
672
+ {
673
+ id: 'aaa-aaa-aaa',
674
+ testOverrides: {
675
+ startUrl: 'fakeUrl',
676
+ },
677
+ },
678
+ {
679
+ localTestDefinition,
680
+ testOverrides: {
681
+ startUrl: 'fakeUrl',
682
+ },
683
+ },
684
+ ],
685
+ },
686
+ };
687
+ jest.spyOn(utils, 'getSuites').mockResolvedValue([suite]);
688
+ yield expect(runTests.getTriggerConfigs(fakeApi, Object.assign(Object.assign({}, fixtures_2.ciConfig), { files: ['glob'], publicIds: ['bbb-bbb-bbb'] }), fixtures_2.mockReporter)).resolves.toEqual([
689
+ {
690
+ localTestDefinition,
691
+ suite: 'Suite with local test definitions',
692
+ testOverrides: { startUrl: 'fakeUrl' },
693
+ },
694
+ ]);
695
+ }));
696
+ });
697
+ });
698
+ //# sourceMappingURL=run-tests-lib.test.js.map