@datadog/datadog-ci 3.3.1 → 3.5.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 (403) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/cloud-run/flare.js +14 -14
  4. package/dist/commands/cloud-run/flare.js.map +1 -1
  5. package/dist/commands/coverage/renderer.js +2 -2
  6. package/dist/commands/coverage/renderer.js.map +1 -1
  7. package/dist/commands/coverage/upload.js +10 -11
  8. package/dist/commands/coverage/upload.js.map +1 -1
  9. package/dist/commands/coverage/utils.js +2 -2
  10. package/dist/commands/coverage/utils.js.map +1 -1
  11. package/dist/commands/dsyms/renderer.js +3 -3
  12. package/dist/commands/dsyms/renderer.js.map +1 -1
  13. package/dist/commands/dsyms/upload.js +9 -9
  14. package/dist/commands/dsyms/upload.js.map +1 -1
  15. package/dist/commands/dsyms/utils.js +4 -4
  16. package/dist/commands/dsyms/utils.js.map +1 -1
  17. package/dist/commands/elf-symbols/upload.js +4 -4
  18. package/dist/commands/elf-symbols/upload.js.map +1 -1
  19. package/dist/commands/flutter-symbols/helpers.js +5 -25
  20. package/dist/commands/flutter-symbols/helpers.js.map +1 -1
  21. package/dist/commands/flutter-symbols/upload.js +2 -2
  22. package/dist/commands/flutter-symbols/upload.js.map +1 -1
  23. package/dist/commands/git-metadata/gitdb.js +4 -4
  24. package/dist/commands/git-metadata/gitdb.js.map +1 -1
  25. package/dist/commands/junit/api.js +2 -2
  26. package/dist/commands/junit/api.js.map +1 -1
  27. package/dist/commands/junit/renderer.js +2 -2
  28. package/dist/commands/junit/renderer.js.map +1 -1
  29. package/dist/commands/junit/upload.js +7 -7
  30. package/dist/commands/junit/upload.js.map +1 -1
  31. package/dist/commands/lambda/constants.d.ts +3 -0
  32. package/dist/commands/lambda/constants.js +5 -2
  33. package/dist/commands/lambda/constants.js.map +1 -1
  34. package/dist/commands/lambda/flare.js +18 -18
  35. package/dist/commands/lambda/flare.js.map +1 -1
  36. package/dist/commands/lambda/functions/instrument.js +10 -0
  37. package/dist/commands/lambda/functions/instrument.js.map +1 -1
  38. package/dist/commands/lambda/functions/uninstrument.js +3 -0
  39. package/dist/commands/lambda/functions/uninstrument.js.map +1 -1
  40. package/dist/commands/lambda/instrument.d.ts +1 -0
  41. package/dist/commands/lambda/instrument.js +5 -2
  42. package/dist/commands/lambda/instrument.js.map +1 -1
  43. package/dist/commands/lambda/interfaces.d.ts +3 -0
  44. package/dist/commands/pe-symbols/upload.js +2 -3
  45. package/dist/commands/pe-symbols/upload.js.map +1 -1
  46. package/dist/commands/react-native/codepush.js +7 -2
  47. package/dist/commands/react-native/codepush.js.map +1 -1
  48. package/dist/commands/react-native/utils.d.ts +1 -0
  49. package/dist/commands/react-native/utils.js +5 -1
  50. package/dist/commands/react-native/utils.js.map +1 -1
  51. package/dist/commands/react-native/xcode.js +1 -2
  52. package/dist/commands/react-native/xcode.js.map +1 -1
  53. package/dist/commands/sarif/renderer.js +3 -3
  54. package/dist/commands/sarif/renderer.js.map +1 -1
  55. package/dist/commands/sarif/upload.js +5 -6
  56. package/dist/commands/sarif/upload.js.map +1 -1
  57. package/dist/commands/sbom/constants.d.ts +1 -0
  58. package/dist/commands/sbom/constants.js +2 -1
  59. package/dist/commands/sbom/constants.js.map +1 -1
  60. package/dist/commands/sbom/payload.js +66 -0
  61. package/dist/commands/sbom/payload.js.map +1 -1
  62. package/dist/commands/sbom/types.d.ts +13 -0
  63. package/dist/commands/sourcemaps/upload.js +4 -5
  64. package/dist/commands/sourcemaps/upload.js.map +1 -1
  65. package/dist/commands/sourcemaps/utils.js +2 -2
  66. package/dist/commands/sourcemaps/utils.js.map +1 -1
  67. package/dist/commands/span/cli.js +5 -0
  68. package/dist/commands/span/cli.js.map +1 -0
  69. package/dist/commands/span/span.d.ts +10 -0
  70. package/dist/commands/span/span.js +112 -0
  71. package/dist/commands/span/span.js.map +1 -0
  72. package/dist/commands/synthetics/api.d.ts +1 -1
  73. package/dist/commands/synthetics/api.js +40 -12
  74. package/dist/commands/synthetics/api.js.map +1 -1
  75. package/dist/commands/synthetics/batch.js +12 -11
  76. package/dist/commands/synthetics/batch.js.map +1 -1
  77. package/dist/commands/synthetics/build-and-test.d.ts +20 -3
  78. package/dist/commands/synthetics/build-and-test.js +157 -63
  79. package/dist/commands/synthetics/build-and-test.js.map +1 -1
  80. package/dist/commands/synthetics/interfaces.d.ts +71 -35
  81. package/dist/commands/synthetics/interfaces.js.map +1 -1
  82. package/dist/commands/synthetics/multilocator.js +2 -2
  83. package/dist/commands/synthetics/multilocator.js.map +1 -1
  84. package/dist/commands/synthetics/reporters/default.js +10 -9
  85. package/dist/commands/synthetics/reporters/default.js.map +1 -1
  86. package/dist/commands/synthetics/reporters/junit.js +74 -63
  87. package/dist/commands/synthetics/reporters/junit.js.map +1 -1
  88. package/dist/commands/synthetics/run-tests-command.js +5 -2
  89. package/dist/commands/synthetics/run-tests-command.js.map +1 -1
  90. package/dist/commands/synthetics/test.d.ts +2 -2
  91. package/dist/commands/synthetics/utils/internal.d.ts +3 -5
  92. package/dist/commands/synthetics/utils/internal.js +2 -17
  93. package/dist/commands/synthetics/utils/internal.js.map +1 -1
  94. package/dist/commands/synthetics/utils/public.d.ts +4 -4
  95. package/dist/commands/synthetics/utils/public.js +22 -11
  96. package/dist/commands/synthetics/utils/public.js.map +1 -1
  97. package/dist/commands/trace/helper.d.ts +16 -0
  98. package/dist/commands/trace/helper.js +123 -0
  99. package/dist/commands/trace/helper.js.map +1 -0
  100. package/dist/commands/trace/test-utils.d.ts +4 -0
  101. package/dist/commands/trace/{__tests__/trace.test.js → test-utils.js} +15 -41
  102. package/dist/commands/trace/test-utils.js.map +1 -0
  103. package/dist/commands/trace/trace.d.ts +2 -12
  104. package/dist/commands/trace/trace.js +14 -93
  105. package/dist/commands/trace/trace.js.map +1 -1
  106. package/dist/commands/unity-symbols/upload.js +7 -7
  107. package/dist/commands/unity-symbols/upload.js.map +1 -1
  108. package/dist/helpers/file-finder.js +3 -3
  109. package/dist/helpers/file-finder.js.map +1 -1
  110. package/dist/helpers/flare.js +6 -5
  111. package/dist/helpers/flare.js.map +1 -1
  112. package/dist/helpers/fs.js +3 -3
  113. package/dist/helpers/fs.js.map +1 -1
  114. package/dist/helpers/glob.d.ts +12 -0
  115. package/dist/helpers/glob.js +70 -0
  116. package/dist/helpers/glob.js.map +1 -0
  117. package/dist/helpers/interfaces.d.ts +5 -6
  118. package/dist/helpers/renderer.js +3 -3
  119. package/dist/helpers/renderer.js.map +1 -1
  120. package/dist/helpers/tags.js +3 -3
  121. package/dist/helpers/tags.js.map +1 -1
  122. package/dist/helpers/utils.d.ts +0 -1
  123. package/dist/helpers/utils.js +1 -12
  124. package/dist/helpers/utils.js.map +1 -1
  125. package/package.json +6 -5
  126. package/dist/__tests__/cli.test.js +0 -93
  127. package/dist/__tests__/cli.test.js.map +0 -1
  128. package/dist/commands/cloud-run/__tests__/fixtures.d.ts +0 -2
  129. package/dist/commands/cloud-run/__tests__/fixtures.js +0 -12
  130. package/dist/commands/cloud-run/__tests__/fixtures.js.map +0 -1
  131. package/dist/commands/cloud-run/__tests__/flare.test.d.ts +0 -1
  132. package/dist/commands/cloud-run/__tests__/flare.test.js +0 -557
  133. package/dist/commands/cloud-run/__tests__/flare.test.js.map +0 -1
  134. package/dist/commands/coverage/__tests__/upload.test.d.ts +0 -1
  135. package/dist/commands/coverage/__tests__/upload.test.js +0 -291
  136. package/dist/commands/coverage/__tests__/upload.test.js.map +0 -1
  137. package/dist/commands/coverage/__tests__/utils.test.d.ts +0 -1
  138. package/dist/commands/coverage/__tests__/utils.test.js +0 -47
  139. package/dist/commands/coverage/__tests__/utils.test.js.map +0 -1
  140. package/dist/commands/deployment/__tests__/correlate.test.d.ts +0 -1
  141. package/dist/commands/deployment/__tests__/correlate.test.js +0 -106
  142. package/dist/commands/deployment/__tests__/correlate.test.js.map +0 -1
  143. package/dist/commands/deployment/__tests__/mark.test.d.ts +0 -1
  144. package/dist/commands/deployment/__tests__/mark.test.js +0 -97
  145. package/dist/commands/deployment/__tests__/mark.test.js.map +0 -1
  146. package/dist/commands/dora/__tests__/deployment.test.d.ts +0 -1
  147. package/dist/commands/dora/__tests__/deployment.test.js +0 -203
  148. package/dist/commands/dora/__tests__/deployment.test.js.map +0 -1
  149. package/dist/commands/dsyms/__tests__/upload.test.d.ts +0 -1
  150. package/dist/commands/dsyms/__tests__/upload.test.js +0 -346
  151. package/dist/commands/dsyms/__tests__/upload.test.js.map +0 -1
  152. package/dist/commands/dsyms/__tests__/utils.test.d.ts +0 -1
  153. package/dist/commands/dsyms/__tests__/utils.test.js +0 -100
  154. package/dist/commands/dsyms/__tests__/utils.test.js.map +0 -1
  155. package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +0 -1
  156. package/dist/commands/elf-symbols/__tests__/elf.test.js +0 -822
  157. package/dist/commands/elf-symbols/__tests__/elf.test.js.map +0 -1
  158. package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +0 -1
  159. package/dist/commands/elf-symbols/__tests__/upload.test.js +0 -228
  160. package/dist/commands/elf-symbols/__tests__/upload.test.js.map +0 -1
  161. package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +0 -1
  162. package/dist/commands/flutter-symbols/__tests__/upload.test.js +0 -617
  163. package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +0 -1
  164. package/dist/commands/gate/__tests__/evaluate.test.d.ts +0 -1
  165. package/dist/commands/gate/__tests__/evaluate.test.js +0 -398
  166. package/dist/commands/gate/__tests__/evaluate.test.js.map +0 -1
  167. package/dist/commands/gate/__tests__/scope.test.d.ts +0 -1
  168. package/dist/commands/gate/__tests__/scope.test.js +0 -29
  169. package/dist/commands/gate/__tests__/scope.test.js.map +0 -1
  170. package/dist/commands/git-metadata/__tests__/git.test.d.ts +0 -1
  171. package/dist/commands/git-metadata/__tests__/git.test.js +0 -132
  172. package/dist/commands/git-metadata/__tests__/git.test.js.map +0 -1
  173. package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +0 -1
  174. package/dist/commands/git-metadata/__tests__/gitdb.test.js +0 -1386
  175. package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +0 -1
  176. package/dist/commands/git-metadata/__tests__/library.test.d.ts +0 -1
  177. package/dist/commands/git-metadata/__tests__/library.test.js +0 -118
  178. package/dist/commands/git-metadata/__tests__/library.test.js.map +0 -1
  179. package/dist/commands/git-metadata/__tests__/upload.test.d.ts +0 -1
  180. package/dist/commands/git-metadata/__tests__/upload.test.js +0 -52
  181. package/dist/commands/git-metadata/__tests__/upload.test.js.map +0 -1
  182. package/dist/commands/junit/__tests__/upload.test.d.ts +0 -1
  183. package/dist/commands/junit/__tests__/upload.test.js +0 -495
  184. package/dist/commands/junit/__tests__/upload.test.js.map +0 -1
  185. package/dist/commands/lambda/__tests__/fixtures.d.ts +0 -51
  186. package/dist/commands/lambda/__tests__/fixtures.js +0 -146
  187. package/dist/commands/lambda/__tests__/fixtures.js.map +0 -1
  188. package/dist/commands/lambda/__tests__/flare.test.d.ts +0 -1
  189. package/dist/commands/lambda/__tests__/flare.test.js +0 -730
  190. package/dist/commands/lambda/__tests__/flare.test.js.map +0 -1
  191. package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +0 -1
  192. package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -791
  193. package/dist/commands/lambda/__tests__/functions/commons.test.js.map +0 -1
  194. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +0 -1
  195. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +0 -386
  196. package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +0 -1
  197. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +0 -1
  198. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +0 -728
  199. package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +0 -1
  200. package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +0 -1
  201. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +0 -513
  202. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +0 -1
  203. package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +0 -1
  204. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +0 -33
  205. package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +0 -1
  206. package/dist/commands/lambda/__tests__/instrument.test.d.ts +0 -1
  207. package/dist/commands/lambda/__tests__/instrument.test.js +0 -1599
  208. package/dist/commands/lambda/__tests__/instrument.test.js.map +0 -1
  209. package/dist/commands/lambda/__tests__/loggroup.test.d.ts +0 -1
  210. package/dist/commands/lambda/__tests__/loggroup.test.js +0 -340
  211. package/dist/commands/lambda/__tests__/loggroup.test.js.map +0 -1
  212. package/dist/commands/lambda/__tests__/prompt.test.d.ts +0 -1
  213. package/dist/commands/lambda/__tests__/prompt.test.js +0 -206
  214. package/dist/commands/lambda/__tests__/prompt.test.js.map +0 -1
  215. package/dist/commands/lambda/__tests__/tags.test.d.ts +0 -1
  216. package/dist/commands/lambda/__tests__/tags.test.js +0 -305
  217. package/dist/commands/lambda/__tests__/tags.test.js.map +0 -1
  218. package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +0 -1
  219. package/dist/commands/lambda/__tests__/uninstrument.test.js +0 -722
  220. package/dist/commands/lambda/__tests__/uninstrument.test.js.map +0 -1
  221. package/dist/commands/measure/__tests__/measure.test.d.ts +0 -1
  222. package/dist/commands/measure/__tests__/measure.test.js +0 -102
  223. package/dist/commands/measure/__tests__/measure.test.js.map +0 -1
  224. package/dist/commands/pe-symbols/__tests__/pe.test.d.ts +0 -1
  225. package/dist/commands/pe-symbols/__tests__/pe.test.js +0 -81
  226. package/dist/commands/pe-symbols/__tests__/pe.test.js.map +0 -1
  227. package/dist/commands/react-native/__tests__/codepush.test.d.ts +0 -1
  228. package/dist/commands/react-native/__tests__/codepush.test.js +0 -161
  229. package/dist/commands/react-native/__tests__/codepush.test.js.map +0 -1
  230. package/dist/commands/react-native/__tests__/interfaces.test.d.ts +0 -1
  231. package/dist/commands/react-native/__tests__/interfaces.test.js +0 -33
  232. package/dist/commands/react-native/__tests__/interfaces.test.js.map +0 -1
  233. package/dist/commands/react-native/__tests__/upload.test.d.ts +0 -1
  234. package/dist/commands/react-native/__tests__/upload.test.js +0 -238
  235. package/dist/commands/react-native/__tests__/upload.test.js.map +0 -1
  236. package/dist/commands/react-native/__tests__/utils.test.d.ts +0 -1
  237. package/dist/commands/react-native/__tests__/utils.test.js +0 -27
  238. package/dist/commands/react-native/__tests__/utils.test.js.map +0 -1
  239. package/dist/commands/react-native/__tests__/xcode.test.d.ts +0 -1
  240. package/dist/commands/react-native/__tests__/xcode.test.js +0 -465
  241. package/dist/commands/react-native/__tests__/xcode.test.js.map +0 -1
  242. package/dist/commands/sarif/__tests__/upload.test.d.ts +0 -1
  243. package/dist/commands/sarif/__tests__/upload.test.js +0 -291
  244. package/dist/commands/sarif/__tests__/upload.test.js.map +0 -1
  245. package/dist/commands/sarif/__tests__/utils.test.d.ts +0 -1
  246. package/dist/commands/sarif/__tests__/utils.test.js +0 -26
  247. package/dist/commands/sarif/__tests__/utils.test.js.map +0 -1
  248. package/dist/commands/sarif/__tests__/validation.test.d.ts +0 -1
  249. package/dist/commands/sarif/__tests__/validation.test.js +0 -19
  250. package/dist/commands/sarif/__tests__/validation.test.js.map +0 -1
  251. package/dist/commands/sbom/__tests__/payload.test.d.ts +0 -1
  252. package/dist/commands/sbom/__tests__/payload.test.js +0 -436
  253. package/dist/commands/sbom/__tests__/payload.test.js.map +0 -1
  254. package/dist/commands/sbom/__tests__/validation.test.d.ts +0 -1
  255. package/dist/commands/sbom/__tests__/validation.test.js +0 -141
  256. package/dist/commands/sbom/__tests__/validation.test.js.map +0 -1
  257. package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +0 -1
  258. package/dist/commands/sourcemaps/__tests__/upload.test.js +0 -270
  259. package/dist/commands/sourcemaps/__tests__/upload.test.js.map +0 -1
  260. package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +0 -1
  261. package/dist/commands/sourcemaps/__tests__/utils.test.js +0 -31
  262. package/dist/commands/sourcemaps/__tests__/utils.test.js.map +0 -1
  263. package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +0 -1
  264. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +0 -210
  265. package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +0 -1
  266. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +0 -6
  267. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +0 -45
  268. package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +0 -1
  269. package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +0 -5
  270. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +0 -19
  271. package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +0 -1
  272. package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +0 -1
  273. package/dist/commands/stepfunctions/__tests__/helpers.test.js +0 -501
  274. package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +0 -1
  275. package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +0 -1
  276. package/dist/commands/stepfunctions/__tests__/instrument.test.js +0 -431
  277. package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +0 -1
  278. package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +0 -1
  279. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +0 -166
  280. package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +0 -1
  281. package/dist/commands/synthetics/__tests__/api.test.d.ts +0 -1
  282. package/dist/commands/synthetics/__tests__/api.test.js +0 -416
  283. package/dist/commands/synthetics/__tests__/api.test.js.map +0 -1
  284. package/dist/commands/synthetics/__tests__/batch.test.d.ts +0 -1
  285. package/dist/commands/synthetics/__tests__/batch.test.js +0 -907
  286. package/dist/commands/synthetics/__tests__/batch.test.js.map +0 -1
  287. package/dist/commands/synthetics/__tests__/build-and-test.test.d.ts +0 -1
  288. package/dist/commands/synthetics/__tests__/build-and-test.test.js +0 -133
  289. package/dist/commands/synthetics/__tests__/build-and-test.test.js.map +0 -1
  290. package/dist/commands/synthetics/__tests__/cli.test.d.ts +0 -1
  291. package/dist/commands/synthetics/__tests__/cli.test.js +0 -1407
  292. package/dist/commands/synthetics/__tests__/cli.test.js.map +0 -1
  293. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.d.ts +0 -1
  294. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js +0 -112
  295. package/dist/commands/synthetics/__tests__/deploy-tests-lib.test.js.map +0 -1
  296. package/dist/commands/synthetics/__tests__/fixtures.d.ts +0 -123
  297. package/dist/commands/synthetics/__tests__/fixtures.js +0 -493
  298. package/dist/commands/synthetics/__tests__/fixtures.js.map +0 -1
  299. package/dist/commands/synthetics/__tests__/import-tests-lib.test.d.ts +0 -1
  300. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js +0 -186
  301. package/dist/commands/synthetics/__tests__/import-tests-lib.test.js.map +0 -1
  302. package/dist/commands/synthetics/__tests__/mobile.test.d.ts +0 -1
  303. package/dist/commands/synthetics/__tests__/mobile.test.js +0 -376
  304. package/dist/commands/synthetics/__tests__/mobile.test.js.map +0 -1
  305. package/dist/commands/synthetics/__tests__/multilocator.test.d.ts +0 -1
  306. package/dist/commands/synthetics/__tests__/multilocator.test.js +0 -142
  307. package/dist/commands/synthetics/__tests__/multilocator.test.js.map +0 -1
  308. package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +0 -1
  309. package/dist/commands/synthetics/__tests__/reporters/default.test.js +0 -410
  310. package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +0 -1
  311. package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +0 -1
  312. package/dist/commands/synthetics/__tests__/reporters/junit.test.js +0 -354
  313. package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +0 -1
  314. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +0 -1
  315. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +0 -232
  316. package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +0 -1
  317. package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +0 -1
  318. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +0 -698
  319. package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +0 -1
  320. package/dist/commands/synthetics/__tests__/test.test.d.ts +0 -1
  321. package/dist/commands/synthetics/__tests__/test.test.js +0 -268
  322. package/dist/commands/synthetics/__tests__/test.test.js.map +0 -1
  323. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +0 -1
  324. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +0 -21
  325. package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +0 -1
  326. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +0 -1
  327. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +0 -80
  328. package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +0 -1
  329. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +0 -1
  330. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +0 -109
  331. package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +0 -1
  332. package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +0 -1
  333. package/dist/commands/synthetics/__tests__/utils/internal.test.js +0 -161
  334. package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +0 -1
  335. package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +0 -1
  336. package/dist/commands/synthetics/__tests__/utils/public.test.js +0 -576
  337. package/dist/commands/synthetics/__tests__/utils/public.test.js.map +0 -1
  338. package/dist/commands/tag/__tests__/tag.test.d.ts +0 -1
  339. package/dist/commands/tag/__tests__/tag.test.js +0 -85
  340. package/dist/commands/tag/__tests__/tag.test.js.map +0 -1
  341. package/dist/commands/trace/__tests__/trace.test.d.ts +0 -1
  342. package/dist/commands/trace/__tests__/trace.test.js.map +0 -1
  343. package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +0 -1
  344. package/dist/commands/unity-symbols/__tests__/upload.test.js +0 -369
  345. package/dist/commands/unity-symbols/__tests__/upload.test.js.map +0 -1
  346. package/dist/helpers/__tests__/app.test.d.ts +0 -1
  347. package/dist/helpers/__tests__/app.test.js +0 -31
  348. package/dist/helpers/__tests__/app.test.js.map +0 -1
  349. package/dist/helpers/__tests__/ci.test.d.ts +0 -1
  350. package/dist/helpers/__tests__/ci.test.js +0 -344
  351. package/dist/helpers/__tests__/ci.test.js.map +0 -1
  352. package/dist/helpers/__tests__/env.test.d.ts +0 -1
  353. package/dist/helpers/__tests__/env.test.js +0 -74
  354. package/dist/helpers/__tests__/env.test.js.map +0 -1
  355. package/dist/helpers/__tests__/fips.test.d.ts +0 -1
  356. package/dist/helpers/__tests__/fips.test.js +0 -30
  357. package/dist/helpers/__tests__/fips.test.js.map +0 -1
  358. package/dist/helpers/__tests__/fixtures.d.ts +0 -41
  359. package/dist/helpers/__tests__/fixtures.js +0 -80
  360. package/dist/helpers/__tests__/fixtures.js.map +0 -1
  361. package/dist/helpers/__tests__/flare.test.d.ts +0 -1
  362. package/dist/helpers/__tests__/flare.test.js +0 -226
  363. package/dist/helpers/__tests__/flare.test.js.map +0 -1
  364. package/dist/helpers/__tests__/fs.test.d.ts +0 -1
  365. package/dist/helpers/__tests__/fs.test.js +0 -189
  366. package/dist/helpers/__tests__/fs.test.js.map +0 -1
  367. package/dist/helpers/__tests__/id.test.d.ts +0 -1
  368. package/dist/helpers/__tests__/id.test.js +0 -24
  369. package/dist/helpers/__tests__/id.test.js.map +0 -1
  370. package/dist/helpers/__tests__/plist.test.d.ts +0 -1
  371. package/dist/helpers/__tests__/plist.test.js +0 -43
  372. package/dist/helpers/__tests__/plist.test.js.map +0 -1
  373. package/dist/helpers/__tests__/prompt.test.d.ts +0 -1
  374. package/dist/helpers/__tests__/prompt.test.js +0 -71
  375. package/dist/helpers/__tests__/prompt.test.js.map +0 -1
  376. package/dist/helpers/__tests__/retry.test.d.ts +0 -1
  377. package/dist/helpers/__tests__/retry.test.js +0 -99
  378. package/dist/helpers/__tests__/retry.test.js.map +0 -1
  379. package/dist/helpers/__tests__/tags.test.d.ts +0 -1
  380. package/dist/helpers/__tests__/tags.test.js +0 -362
  381. package/dist/helpers/__tests__/tags.test.js.map +0 -1
  382. package/dist/helpers/__tests__/upload.test.d.ts +0 -1
  383. package/dist/helpers/__tests__/upload.test.js +0 -231
  384. package/dist/helpers/__tests__/upload.test.js.map +0 -1
  385. package/dist/helpers/__tests__/user-provided-git.test.d.ts +0 -1
  386. package/dist/helpers/__tests__/user-provided-git.test.js +0 -119
  387. package/dist/helpers/__tests__/user-provided-git.test.js.map +0 -1
  388. package/dist/helpers/__tests__/utils.test.d.ts +0 -1
  389. package/dist/helpers/__tests__/utils.test.js +0 -429
  390. package/dist/helpers/__tests__/utils.test.js.map +0 -1
  391. package/dist/helpers/__tests__/validation.test.d.ts +0 -1
  392. package/dist/helpers/__tests__/validation.test.js +0 -25
  393. package/dist/helpers/__tests__/validation.test.js.map +0 -1
  394. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +0 -1
  395. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +0 -103
  396. package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +0 -1
  397. package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +0 -1
  398. package/dist/helpers/git/__tests__/format-git-span-data.test.js +0 -121
  399. package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +0 -1
  400. package/dist/helpers/git/__tests__/get-git-data.test.d.ts +0 -1
  401. package/dist/helpers/git/__tests__/get-git-data.test.js +0 -72
  402. package/dist/helpers/git/__tests__/get-git-data.test.js.map +0 -1
  403. /package/dist/{__tests__/cli.test.d.ts → commands/span/cli.d.ts} +0 -0
@@ -1,730 +0,0 @@
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 process_1 = __importDefault(require("process"));
40
- const stream_1 = __importDefault(require("stream"));
41
- const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
42
- const client_lambda_1 = require("@aws-sdk/client-lambda");
43
- const aws_sdk_client_mock_1 = require("aws-sdk-client-mock");
44
- const constants_1 = require("../../../constants");
45
- const fixtures_1 = require("../../../helpers/__tests__/fixtures");
46
- const helpersFlareModule = __importStar(require("../../../helpers/flare"));
47
- const fsModule = __importStar(require("../../../helpers/fs"));
48
- const helpersPromptModule = __importStar(require("../../../helpers/prompt"));
49
- const constants_2 = require("../constants");
50
- const flare_1 = require("../flare");
51
- const flareModule = __importStar(require("../flare"));
52
- const commons_1 = require("../functions/commons");
53
- const prompt_1 = require("../prompt");
54
- const fixtures_2 = require("./fixtures");
55
- // Constants
56
- const MOCK_REGION = 'us-east-1';
57
- const MOCK_REQUIRED_FLAGS = ['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-c', '123', '-e', 'test@test.com'];
58
- const MOCK_LOG_GROUP = 'mockLogGroup';
59
- const MOCK_TAGS = { Tags: {} };
60
- const cloudWatchLogsClientMock = (0, aws_sdk_client_mock_1.mockClient)(client_cloudwatch_logs_1.CloudWatchLogsClient);
61
- const lambdaClientMock = (0, aws_sdk_client_mock_1.mockClient)(client_lambda_1.LambdaClient);
62
- // Commons mocks
63
- jest.mock('../functions/commons', () => (Object.assign(Object.assign({}, jest.requireActual('../functions/commons')), { getAWSCredentials: jest.fn(), getLambdaFunctionConfig: jest.fn().mockImplementation(() => Promise.resolve(fixtures_2.MOCK_LAMBDA_CONFIG)) })));
64
- // Prompt mocks
65
- jest.mock('../prompt');
66
- jest.spyOn(helpersPromptModule, 'requestFilePath').mockResolvedValue('');
67
- jest.spyOn(helpersPromptModule, 'requestConfirmation').mockResolvedValue(true);
68
- jest.spyOn(helpersFlareModule, 'getProjectFiles').mockResolvedValue(new Set());
69
- // File system mocks
70
- jest.spyOn(process_1.default, 'cwd').mockReturnValue(fixtures_1.MOCK_CWD);
71
- jest.mock('fs');
72
- fs_1.default.writeFileSync = jest.fn().mockImplementation(() => { });
73
- fs_1.default.readFileSync = jest.fn().mockReturnValue(JSON.stringify(fixtures_2.MOCK_LAMBDA_CONFIG, undefined, 2));
74
- fs_1.default.existsSync = jest.fn().mockReturnValue(true);
75
- fs_1.default.createReadStream = jest.fn().mockImplementation(() =>
76
- // Return a different stream every time, otherwise a `MaxListenersExceededWarning` is generated
77
- // when appending this stream to the `FormData` under `flare_file`.
78
- new stream_1.default.Readable({
79
- read() {
80
- this.push(JSON.stringify(fixtures_2.MOCK_LAMBDA_CONFIG, undefined, 2));
81
- this.push(undefined);
82
- },
83
- }));
84
- fs_1.default.readdirSync = jest.fn().mockReturnValue([]);
85
- fs_1.default.statSync.mockImplementation((file_path) => ({
86
- isDirectory: () => file_path === fixtures_1.MOCK_FLARE_FOLDER_PATH || file_path === fixtures_1.MOCK_CWD,
87
- }));
88
- // Date
89
- jest.useFakeTimers({ now: new Date(Date.UTC(2023, 0)) });
90
- jest.spyOn(flareModule, 'sleep').mockResolvedValue();
91
- // Misc
92
- jest.mock('util');
93
- jest.mock('jszip');
94
- jest.mock('../../../../package.json', () => ({
95
- version: '1.0-mock-version',
96
- }));
97
- describe('lambda flare', () => {
98
- beforeAll(() => {
99
- (0, fixtures_2.mockResourceTags)(lambdaClientMock, MOCK_TAGS);
100
- });
101
- describe('prints correct headers', () => {
102
- it('prints non-dry-run header', () => __awaiter(void 0, void 0, void 0, function* () {
103
- const cli = (0, fixtures_2.makeCli)();
104
- const context = (0, fixtures_1.createMockContext)();
105
- const code = yield cli.run(['lambda', 'flare'], context);
106
- const output = context.stdout.toString();
107
- expect(code).toBe(1);
108
- expect(output).toMatchSnapshot();
109
- }));
110
- it('prints dry-run header', () => __awaiter(void 0, void 0, void 0, function* () {
111
- const cli = (0, fixtures_2.makeCli)();
112
- const context = (0, fixtures_1.createMockContext)();
113
- const code = yield cli.run(['lambda', 'flare', '-d'], context);
114
- const output = context.stdout.toString();
115
- expect(code).toBe(1);
116
- expect(output).toMatchSnapshot();
117
- }));
118
- });
119
- describe('validates required flags', () => {
120
- beforeEach(() => {
121
- process_1.default.env = { [constants_1.CI_API_KEY_ENV_VAR]: fixtures_1.MOCK_DATADOG_API_KEY };
122
- });
123
- it('prints error when no function specified', () => __awaiter(void 0, void 0, void 0, function* () {
124
- const cli = (0, fixtures_2.makeCli)();
125
- const context = (0, fixtures_1.createMockContext)();
126
- const code = yield cli.run(['lambda', 'flare', '-r', MOCK_REGION, '-c', '123', '-e', 'test@test.com'], context);
127
- expect(code).toBe(1);
128
- const output = context.stdout.toString();
129
- expect(output).toMatchSnapshot();
130
- }));
131
- it('prints error when no region specified', () => __awaiter(void 0, void 0, void 0, function* () {
132
- const cli = (0, fixtures_2.makeCli)();
133
- const context = (0, fixtures_1.createMockContext)();
134
- const code = yield cli.run(['lambda', 'flare', '-f', 'func', '-c', '123', '-e', 'test@test.com'], context);
135
- expect(code).toBe(1);
136
- const output = context.stdout.toString();
137
- expect(output).toMatchSnapshot();
138
- }));
139
- it('extracts region from function name when given a function ARN', () => __awaiter(void 0, void 0, void 0, function* () {
140
- const cli = (0, fixtures_2.makeCli)();
141
- const context = (0, fixtures_1.createMockContext)();
142
- const code = yield cli.run([
143
- 'lambda',
144
- 'flare',
145
- '-f',
146
- 'arn:aws:lambda:us-east-1:123456789012:function:my-function',
147
- '-c',
148
- '123',
149
- '-e',
150
- 'test@test.com',
151
- ], context);
152
- expect(code).toBe(0);
153
- const output = context.stdout.toString();
154
- expect(output).toMatchSnapshot();
155
- }));
156
- it('uses region ENV variable when no region specified', () => __awaiter(void 0, void 0, void 0, function* () {
157
- process_1.default.env[constants_2.AWS_DEFAULT_REGION_ENV_VAR] = 'test-region';
158
- const cli = (0, fixtures_2.makeCli)();
159
- const context = (0, fixtures_1.createMockContext)();
160
- const code = yield cli.run(['lambda', 'flare', '-f', 'func', '-c', '123', '-e', 'test@test.com'], context);
161
- expect(code).toBe(0);
162
- const output = context.stdout.toString();
163
- expect(output).toMatchSnapshot();
164
- }));
165
- it('prints error when no API key in env variables', () => __awaiter(void 0, void 0, void 0, function* () {
166
- process_1.default.env = {};
167
- const cli = (0, fixtures_2.makeCli)();
168
- const context = (0, fixtures_1.createMockContext)();
169
- const code = yield cli.run(['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-c', '123', '-e', 'test@test.com'], context);
170
- expect(code).toBe(1);
171
- const output = context.stdout.toString();
172
- expect(output).toMatchSnapshot();
173
- }));
174
- it('uses API key ENV variable and runs as expected', () => __awaiter(void 0, void 0, void 0, function* () {
175
- process_1.default.env = {};
176
- process_1.default.env[constants_1.CI_API_KEY_ENV_VAR] = fixtures_1.MOCK_DATADOG_API_KEY;
177
- process_1.default.env[constants_1.API_KEY_ENV_VAR] = undefined;
178
- const cli = (0, fixtures_2.makeCli)();
179
- const context = (0, fixtures_1.createMockContext)();
180
- let code = yield cli.run(['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-c', '123', '-e', 'test@test.com'], context);
181
- expect(code).toBe(0);
182
- let output = context.stdout.toString();
183
- expect(output).toMatchSnapshot();
184
- process_1.default.env[constants_1.CI_API_KEY_ENV_VAR] = undefined;
185
- process_1.default.env[constants_1.API_KEY_ENV_VAR] = fixtures_1.MOCK_DATADOG_API_KEY;
186
- code = yield cli.run(['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-c', '123', '-e', 'test@test.com'], context);
187
- expect(code).toBe(0);
188
- output = context.stdout.toString();
189
- expect(output).toMatchSnapshot();
190
- }));
191
- it('prints error when no case ID specified', () => __awaiter(void 0, void 0, void 0, function* () {
192
- const cli = (0, fixtures_2.makeCli)();
193
- const context = (0, fixtures_1.createMockContext)();
194
- const code = yield cli.run(['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-e', 'test@test.com'], context);
195
- expect(code).toBe(1);
196
- const output = context.stdout.toString();
197
- expect(output).toMatchSnapshot();
198
- }));
199
- it('prints error when no email specified', () => __awaiter(void 0, void 0, void 0, function* () {
200
- const cli = (0, fixtures_2.makeCli)();
201
- const context = (0, fixtures_1.createMockContext)();
202
- const code = yield cli.run(['lambda', 'flare', '-f', 'func', '-r', MOCK_REGION, '-c', '123'], context);
203
- expect(code).toBe(1);
204
- const output = context.stdout.toString();
205
- expect(output).toMatchSnapshot();
206
- }));
207
- it('runs successfully with all required options specified', () => __awaiter(void 0, void 0, void 0, function* () {
208
- const cli = (0, fixtures_2.makeCli)();
209
- const context = (0, fixtures_1.createMockContext)();
210
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
211
- expect(code).toBe(0);
212
- const output = context.stdout.toString();
213
- expect(output).toMatchSnapshot();
214
- }));
215
- it('prints error when start time is specified but end time is not', () => __awaiter(void 0, void 0, void 0, function* () {
216
- const cli = (0, fixtures_2.makeCli)();
217
- const context = (0, fixtures_1.createMockContext)();
218
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--start', '100'], context);
219
- expect(code).toBe(1);
220
- const output = context.stdout.toString();
221
- expect(output).toMatchSnapshot();
222
- }));
223
- it('prints error when end time is specified but start time is not', () => __awaiter(void 0, void 0, void 0, function* () {
224
- const cli = (0, fixtures_2.makeCli)();
225
- const context = (0, fixtures_1.createMockContext)();
226
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--end', '100'], context);
227
- expect(code).toBe(1);
228
- const output = context.stdout.toString();
229
- expect(output).toMatchSnapshot();
230
- }));
231
- it('prints error when start time is invalid', () => __awaiter(void 0, void 0, void 0, function* () {
232
- const cli = (0, fixtures_2.makeCli)();
233
- const context = (0, fixtures_1.createMockContext)();
234
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--start', '123abc', '--end', '200'], context);
235
- expect(code).toBe(1);
236
- const output = context.stdout.toString();
237
- expect(output).toMatchSnapshot();
238
- }));
239
- it('prints error when end time is invalid', () => __awaiter(void 0, void 0, void 0, function* () {
240
- const cli = (0, fixtures_2.makeCli)();
241
- const context = (0, fixtures_1.createMockContext)();
242
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--start', '100', '--end', '123abc'], context);
243
- expect(code).toBe(1);
244
- const output = context.stdout.toString();
245
- expect(output).toMatchSnapshot();
246
- }));
247
- it('prints error when start time is after end time', () => __awaiter(void 0, void 0, void 0, function* () {
248
- const cli = (0, fixtures_2.makeCli)();
249
- const context = (0, fixtures_1.createMockContext)();
250
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--start', '200', '--end', '100'], context);
251
- expect(code).toBe(1);
252
- const output = context.stdout.toString();
253
- expect(output).toMatchSnapshot();
254
- }));
255
- it('runs successfully when start and end times are valid', () => __awaiter(void 0, void 0, void 0, function* () {
256
- const cli = (0, fixtures_2.makeCli)();
257
- const context = (0, fixtures_1.createMockContext)();
258
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '--start', '100', '--end', '200'], context);
259
- expect(code).toBe(0);
260
- const output = context.stdout.toString();
261
- expect(output).toMatchSnapshot();
262
- }));
263
- });
264
- describe('getLogStreamNames', () => {
265
- beforeEach(() => {
266
- cloudWatchLogsClientMock.reset();
267
- (0, fixtures_2.mockCloudWatchLogsClientCommands)(cloudWatchLogsClientMock);
268
- });
269
- it('returns the 3 latest log stream names sorted by last event time', () => __awaiter(void 0, void 0, void 0, function* () {
270
- const mockStreams = [
271
- { logStreamName: 'Stream3' },
272
- { logStreamName: 'Stream2' },
273
- { logStreamName: 'Stream1' },
274
- ];
275
- (0, fixtures_2.mockCloudWatchLogStreams)(cloudWatchLogsClientMock, mockStreams);
276
- const expectedLogStreams = ['Stream1', 'Stream2', 'Stream3'];
277
- const logStreams = yield (0, flare_1.getLogStreamNames)(new client_cloudwatch_logs_1.CloudWatchLogsClient({}), MOCK_LOG_GROUP);
278
- expect(logStreams).toEqual(expectedLogStreams);
279
- }));
280
- it('returns empty array when no log streams are found', () => __awaiter(void 0, void 0, void 0, function* () {
281
- (0, fixtures_2.mockCloudWatchLogStreams)(cloudWatchLogsClientMock, []);
282
- const logStreams = yield (0, flare_1.getLogStreamNames)(new client_cloudwatch_logs_1.CloudWatchLogsClient({}), MOCK_LOG_GROUP);
283
- expect(logStreams).toEqual([]);
284
- }));
285
- it('throws error when log streams cannot be retrieved', () => __awaiter(void 0, void 0, void 0, function* () {
286
- cloudWatchLogsClientMock.on(client_cloudwatch_logs_1.DescribeLogStreamsCommand).rejects('Cannot retrieve log streams');
287
- yield expect((0, flare_1.getLogStreamNames)(cloudWatchLogsClientMock, MOCK_LOG_GROUP)).rejects.toThrow('Cannot retrieve log streams');
288
- }));
289
- it('returns log streams within the specified time range', () => __awaiter(void 0, void 0, void 0, function* () {
290
- const mockStreams = [
291
- { logStreamName: 'Stream1', firstEventTimestamp: 100, lastEventTimestamp: 200 },
292
- { logStreamName: 'Stream2', firstEventTimestamp: 200, lastEventTimestamp: 300 },
293
- { logStreamName: 'Stream3', firstEventTimestamp: 300, lastEventTimestamp: 400 },
294
- { logStreamName: 'Stream4', firstEventTimestamp: 400, lastEventTimestamp: 500 },
295
- ];
296
- (0, fixtures_2.mockCloudWatchLogStreams)(cloudWatchLogsClientMock, mockStreams);
297
- const expectedLogStreams = ['Stream2', 'Stream1'];
298
- const logStreams = yield (0, flare_1.getLogStreamNames)(new client_cloudwatch_logs_1.CloudWatchLogsClient({}), MOCK_LOG_GROUP, 0, 250);
299
- expect(logStreams).toEqual(expectedLogStreams);
300
- }));
301
- });
302
- describe('getLogEvents', () => {
303
- beforeEach(() => {
304
- cloudWatchLogsClientMock.reset();
305
- (0, fixtures_2.mockCloudWatchLogsClientCommands)(cloudWatchLogsClientMock);
306
- });
307
- const MOCK_LOG_STREAM = 'mockLogStream';
308
- it('returns the log events for a log stream', () => __awaiter(void 0, void 0, void 0, function* () {
309
- (0, fixtures_2.mockCloudWatchLogEvents)(cloudWatchLogsClientMock, [
310
- { timestamp: 123, message: 'Log1' },
311
- { timestamp: 456, message: 'Log2' },
312
- ]);
313
- const expectedEvents = [
314
- { timestamp: 123, message: 'Log1' },
315
- { timestamp: 456, message: 'Log2' },
316
- ];
317
- const logEvents = yield (0, flare_1.getLogEvents)(cloudWatchLogsClientMock, MOCK_LOG_GROUP, MOCK_LOG_STREAM);
318
- expect(logEvents).toEqual(expectedEvents);
319
- }));
320
- it('returns empty array when no log events are found', () => __awaiter(void 0, void 0, void 0, function* () {
321
- (0, fixtures_2.mockCloudWatchLogEvents)(cloudWatchLogsClientMock, []);
322
- const logEvents = yield (0, flare_1.getLogEvents)(cloudWatchLogsClientMock, MOCK_LOG_GROUP, MOCK_LOG_STREAM);
323
- expect(logEvents).toEqual([]);
324
- }));
325
- it('throws error when log events cannot be retrieved', () => __awaiter(void 0, void 0, void 0, function* () {
326
- cloudWatchLogsClientMock.on(client_cloudwatch_logs_1.GetLogEventsCommand).rejects('Cannot retrieve log events');
327
- yield expect((0, flare_1.getLogEvents)(cloudWatchLogsClientMock, MOCK_LOG_GROUP, MOCK_LOG_STREAM)).rejects.toThrow('Cannot retrieve log events');
328
- }));
329
- it('sets start and end time when provided', () => __awaiter(void 0, void 0, void 0, function* () {
330
- const mockStartTime = 100;
331
- const mockEndTime = 200;
332
- const logEvents = [
333
- { timestamp: 125, message: 'Log1' },
334
- { timestamp: 150, message: 'Log2' },
335
- { timestamp: 175, message: 'Log3' },
336
- ];
337
- const sendMock = jest.fn().mockResolvedValue({ events: logEvents });
338
- cloudWatchLogsClientMock.send = sendMock;
339
- const logEventsResult = yield (0, flare_1.getLogEvents)(cloudWatchLogsClientMock, MOCK_LOG_GROUP, MOCK_LOG_STREAM, mockStartTime, mockEndTime);
340
- expect(sendMock).toHaveBeenCalledWith(expect.objectContaining({
341
- input: expect.objectContaining({
342
- logGroupName: MOCK_LOG_GROUP,
343
- logStreamName: MOCK_LOG_STREAM,
344
- limit: 1000,
345
- startTime: mockStartTime,
346
- endTime: mockEndTime,
347
- }),
348
- }));
349
- expect(logEventsResult).toEqual(logEvents);
350
- }));
351
- });
352
- describe('getAllLogs', () => {
353
- const functionName = 'testFunction';
354
- const mockStreamName = 'streamName';
355
- it('returns a map of log streams and their events', () => __awaiter(void 0, void 0, void 0, function* () {
356
- const mockLogs = [
357
- { timestamp: 123, message: 'log message 1' },
358
- { timestamp: 124, message: 'log message 2' },
359
- ];
360
- jest.spyOn(flareModule, 'getLogStreamNames').mockResolvedValue([mockStreamName]);
361
- jest.spyOn(flareModule, 'getLogEvents').mockResolvedValue(mockLogs);
362
- const result = yield (0, flare_1.getAllLogs)(MOCK_REGION, functionName);
363
- expect(result.get(mockStreamName)).toEqual(mockLogs);
364
- }));
365
- it('throws an error when unable to get log streams', () => __awaiter(void 0, void 0, void 0, function* () {
366
- jest.spyOn(flareModule, 'getLogStreamNames').mockRejectedValueOnce(new Error('Error getting log streams'));
367
- yield expect((0, flare_1.getAllLogs)(MOCK_REGION, functionName)).rejects.toMatchSnapshot();
368
- }));
369
- it('throws an error when unable to get log events', () => __awaiter(void 0, void 0, void 0, function* () {
370
- jest.spyOn(flareModule, 'getLogStreamNames').mockResolvedValueOnce([mockStreamName]);
371
- jest.spyOn(flareModule, 'getLogEvents').mockRejectedValueOnce(new Error('Error getting log events'));
372
- yield expect((0, flare_1.getAllLogs)(MOCK_REGION, functionName)).rejects.toMatchSnapshot();
373
- }));
374
- });
375
- describe('gets CloudWatch Logs', () => {
376
- process_1.default.env = { [constants_1.CI_API_KEY_ENV_VAR]: fixtures_1.MOCK_DATADOG_API_KEY };
377
- const FLAGS_WITH_LOGS = [...MOCK_REQUIRED_FLAGS, '--with-logs'];
378
- const mockLogStreamNames = ['Stream1', 'Stream2', 'Stream3'];
379
- const mockLogEvents = [
380
- { timestamp: 123, message: 'Log1' },
381
- { timestamp: 456, message: 'Log2' },
382
- ];
383
- beforeEach(() => {
384
- jest.spyOn(flareModule, 'getLogStreamNames').mockResolvedValue(mockLogStreamNames);
385
- jest.spyOn(flareModule, 'getLogEvents').mockResolvedValue(mockLogEvents);
386
- });
387
- it('gets logs, saves, and sends correctly when --with-logs is included', () => __awaiter(void 0, void 0, void 0, function* () {
388
- const cli = (0, fixtures_2.makeCli)();
389
- const context = (0, fixtures_1.createMockContext)();
390
- const code = yield cli.run(FLAGS_WITH_LOGS, context);
391
- expect(code).toBe(0);
392
- const output = context.stdout.toString();
393
- expect(output).toMatchSnapshot();
394
- }));
395
- it('does not get logs when --with-logs is not included', () => __awaiter(void 0, void 0, void 0, function* () {
396
- const cli = (0, fixtures_2.makeCli)();
397
- const context = (0, fixtures_1.createMockContext)();
398
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
399
- expect(code).toBe(0);
400
- const output = context.stdout.toString();
401
- expect(output).toMatchSnapshot();
402
- }));
403
- it('prints error when getLogStreamNames throws error', () => __awaiter(void 0, void 0, void 0, function* () {
404
- jest.spyOn(flareModule, 'getLogStreamNames').mockImplementation(() => {
405
- throw new Error('MOCK ERROR: Unable to get log stream names');
406
- });
407
- const cli = (0, fixtures_2.makeCli)();
408
- const context = (0, fixtures_1.createMockContext)();
409
- const code = yield cli.run(FLAGS_WITH_LOGS, context);
410
- expect(code).toBe(1);
411
- const output = context.stdout.toString();
412
- expect(output).toMatchSnapshot();
413
- }));
414
- it('warns and skips getting logs when getLogStreamNames returns []', () => __awaiter(void 0, void 0, void 0, function* () {
415
- jest.spyOn(flareModule, 'getLogStreamNames').mockResolvedValue([]);
416
- const cli = (0, fixtures_2.makeCli)();
417
- const context = (0, fixtures_1.createMockContext)();
418
- const code = yield cli.run(FLAGS_WITH_LOGS, context);
419
- expect(code).toBe(0);
420
- const output = context.stdout.toString();
421
- expect(output).toMatchSnapshot();
422
- }));
423
- it('prints error when getLogEvents throws error', () => __awaiter(void 0, void 0, void 0, function* () {
424
- jest.spyOn(flareModule, 'getLogEvents').mockImplementation(() => {
425
- throw new Error('MOCK ERROR: Unable to get log events');
426
- });
427
- const cli = (0, fixtures_2.makeCli)();
428
- const context = (0, fixtures_1.createMockContext)();
429
- const code = yield cli.run(FLAGS_WITH_LOGS, context);
430
- expect(code).toBe(1);
431
- const output = context.stdout.toString();
432
- expect(output).toMatchSnapshot();
433
- }));
434
- it('warns and skips log when getLogEvents returns []', () => __awaiter(void 0, void 0, void 0, function* () {
435
- jest.spyOn(flareModule, 'getLogEvents').mockResolvedValue([]);
436
- const cli = (0, fixtures_2.makeCli)();
437
- const context = (0, fixtures_1.createMockContext)();
438
- const code = yield cli.run(FLAGS_WITH_LOGS, context);
439
- expect(code).toBe(0);
440
- const output = context.stdout.toString();
441
- expect(output).toMatchSnapshot();
442
- }));
443
- });
444
- describe('getTags', () => {
445
- const MOCK_ARN = 'arn:aws:lambda:us-east-1:123456789012:function:my-function';
446
- afterAll(() => {
447
- (0, fixtures_2.mockResourceTags)(lambdaClientMock, MOCK_TAGS);
448
- });
449
- it('should return the tags when they exist', () => __awaiter(void 0, void 0, void 0, function* () {
450
- const mockTags = { Tags: { Key1: 'Value1', Key2: 'Value2' } };
451
- (0, fixtures_2.mockResourceTags)(lambdaClientMock, mockTags);
452
- const tags = yield (0, flare_1.getTags)(lambdaClientMock, MOCK_REGION, MOCK_ARN);
453
- expect(tags).toMatchSnapshot();
454
- }));
455
- it('should return an empty object when there are no tags', () => __awaiter(void 0, void 0, void 0, function* () {
456
- const mockTags = { Tags: {} };
457
- (0, fixtures_2.mockResourceTags)(lambdaClientMock, mockTags);
458
- const tags = yield (0, flare_1.getTags)(lambdaClientMock, MOCK_REGION, MOCK_ARN);
459
- expect(tags).toEqual({});
460
- }));
461
- it('should throw an error when the command fails', () => __awaiter(void 0, void 0, void 0, function* () {
462
- const errorMessage = 'Unable to get resource tags: Test Error';
463
- lambdaClientMock.on(client_lambda_1.ListTagsCommand).rejects(new Error('Test Error'));
464
- yield expect((0, flare_1.getTags)(lambdaClientMock, MOCK_REGION, MOCK_ARN)).rejects.toThrow(errorMessage);
465
- }));
466
- });
467
- describe('convertToCSV', () => {
468
- it('returns a CSV string from an array of log events', () => {
469
- const mockLogEvents = [
470
- { timestamp: 123, message: 'Log 1' },
471
- { timestamp: 456, message: 'Log 2' },
472
- ];
473
- expect((0, flare_1.convertToCSV)(mockLogEvents)).toMatchSnapshot();
474
- });
475
- it('handles missing timestamp and message in log events', () => {
476
- const mockLogEvents = [
477
- { timestamp: undefined, message: 'Log 1' },
478
- { timestamp: 456, message: undefined },
479
- ];
480
- expect((0, flare_1.convertToCSV)(mockLogEvents)).toMatchSnapshot();
481
- });
482
- it('returns a CSV string with only headers when given an empty array', () => {
483
- const mockLogEvents = [];
484
- expect((0, flare_1.convertToCSV)(mockLogEvents)).toMatchSnapshot();
485
- });
486
- });
487
- describe('getFramework', () => {
488
- it('returns Serverless Framework when serverless.yml exists', () => {
489
- ;
490
- fs_1.default.readdirSync.mockReturnValueOnce(['serverless.yml', 'test.js']);
491
- expect((0, flare_1.getFramework)()).toBe(constants_2.DeploymentFrameworks.ServerlessFramework);
492
- });
493
- it('returns AWS CDK when cdk.json exists', () => {
494
- ;
495
- fs_1.default.readdirSync.mockReturnValueOnce(['abc.md', 'Dockerfile', 'cdk.json']);
496
- expect((0, flare_1.getFramework)()).toBe(constants_2.DeploymentFrameworks.AwsCdk);
497
- });
498
- it('returns AWS CloudFormation when template.yaml exists', () => {
499
- ;
500
- fs_1.default.readdirSync.mockReturnValueOnce(['abc.md', 'template.yaml', 'Dockerfile']);
501
- expect((0, flare_1.getFramework)()).toBe(constants_2.DeploymentFrameworks.AwsCloudFormation);
502
- });
503
- it('returns Unknown when no framework files exist', () => {
504
- ;
505
- fs_1.default.readdirSync.mockReturnValueOnce(['abc.md', 'Dockerfile', 'test.js', 'README.md']);
506
- expect((0, flare_1.getFramework)()).toBe(constants_2.DeploymentFrameworks.Unknown);
507
- });
508
- it('returns multiple frameworks when multiple are found', () => {
509
- ;
510
- fs_1.default.readdirSync.mockReturnValueOnce(['serverless.yml', 'cdk.json', 'Dockerfile']);
511
- expect((0, flare_1.getFramework)()).toBe(`${constants_2.DeploymentFrameworks.ServerlessFramework}, ${constants_2.DeploymentFrameworks.AwsCdk}`);
512
- });
513
- });
514
- describe('generateInsightsFile', () => {
515
- const insightsFilePath = 'mock/INSIGHTS.md';
516
- const writeFileSpy = jest.spyOn(fsModule, 'writeFile');
517
- it('should call writeFile with correct content when isDryRun is false', () => {
518
- (0, flare_1.generateInsightsFile)(insightsFilePath, false, (0, commons_1.maskConfig)(fixtures_2.MOCK_LAMBDA_CONFIG));
519
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
520
- const receivedContent = writeFileSpy.mock.calls[0][1];
521
- expect(receivedContent).toMatchSnapshot();
522
- });
523
- it('should call writeFile with correct content when isDryRun is true', () => {
524
- (0, flare_1.generateInsightsFile)(insightsFilePath, true, (0, commons_1.maskConfig)(fixtures_2.MOCK_LAMBDA_CONFIG));
525
- expect(writeFileSpy).toHaveBeenCalledTimes(1);
526
- const receivedContent = writeFileSpy.mock.calls[0][1];
527
- expect(receivedContent).toMatchSnapshot();
528
- });
529
- it('prints a warning when generateInsightsFile() errors', () => __awaiter(void 0, void 0, void 0, function* () {
530
- jest.spyOn(flareModule, 'generateInsightsFile').mockImplementationOnce(() => {
531
- throw new Error('Some error');
532
- });
533
- const cli = (0, fixtures_2.makeCli)();
534
- const context = (0, fixtures_1.createMockContext)();
535
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
536
- const output = context.stdout.toString();
537
- expect(code).toBe(0);
538
- expect(output).toMatchSnapshot();
539
- }));
540
- });
541
- describe('AWS Lambda configuration', () => {
542
- it('stops and prints error when getLambdaFunctionConfig fails', () => __awaiter(void 0, void 0, void 0, function* () {
543
- ;
544
- commons_1.getLambdaFunctionConfig.mockImplementation(() => {
545
- throw new Error('MOCK ERROR: Some API error');
546
- });
547
- const cli = (0, fixtures_2.makeCli)();
548
- const context = (0, fixtures_1.createMockContext)();
549
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
550
- expect(code).toBe(1);
551
- const output = context.stdout.toString();
552
- expect(output).toMatchSnapshot();
553
- }));
554
- it('prints config when running as a dry run', () => __awaiter(void 0, void 0, void 0, function* () {
555
- ;
556
- commons_1.getLambdaFunctionConfig.mockImplementation(() => Promise.resolve(fixtures_2.MOCK_LAMBDA_CONFIG));
557
- const cli = (0, fixtures_2.makeCli)();
558
- const context = (0, fixtures_1.createMockContext)();
559
- const code = yield cli.run([...MOCK_REQUIRED_FLAGS, '-d'], context);
560
- expect(code).toBe(0);
561
- const output = context.stdout.toString();
562
- expect(output).toMatchSnapshot();
563
- }));
564
- });
565
- describe('AWS credentials', () => {
566
- it('continues when getAWSCredentials() returns valid credentials', () => __awaiter(void 0, void 0, void 0, function* () {
567
- ;
568
- commons_1.getAWSCredentials.mockResolvedValue(fixtures_2.mockAwsCredentials);
569
- const cli = (0, fixtures_2.makeCli)();
570
- const context = (0, fixtures_1.createMockContext)();
571
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
572
- expect(code).toBe(0);
573
- const output = context.stdout.toString();
574
- expect(output).toMatchSnapshot();
575
- expect(prompt_1.requestAWSCredentials).not.toHaveBeenCalled();
576
- }));
577
- it('requests AWS credentials when none are found by getAWSCredentials()', () => __awaiter(void 0, void 0, void 0, function* () {
578
- ;
579
- commons_1.getAWSCredentials.mockResolvedValue(undefined);
580
- const cli = (0, fixtures_2.makeCli)();
581
- const context = (0, fixtures_1.createMockContext)();
582
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
583
- expect(code).toBe(0);
584
- const output = context.stdout.toString();
585
- expect(output).toMatchSnapshot();
586
- expect(prompt_1.requestAWSCredentials).toHaveBeenCalled();
587
- }));
588
- it('stops and prints error when getAWSCredentials() fails', () => __awaiter(void 0, void 0, void 0, function* () {
589
- ;
590
- commons_1.getAWSCredentials.mockImplementation(() => {
591
- throw new Error('MOCK ERROR: Error getting AWS credentials');
592
- });
593
- const cli = (0, fixtures_2.makeCli)();
594
- const context = (0, fixtures_1.createMockContext)();
595
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
596
- expect(code).toBe(1);
597
- const output = context.stdout.toString();
598
- expect(output).toMatchSnapshot();
599
- }));
600
- it('stops and prints error when requestAWSCredentials() fails', () => __awaiter(void 0, void 0, void 0, function* () {
601
- ;
602
- commons_1.getAWSCredentials.mockResolvedValue(undefined);
603
- prompt_1.requestAWSCredentials.mockImplementation(() => {
604
- throw new Error('MOCK ERROR: Error requesting AWS credentials');
605
- });
606
- const cli = (0, fixtures_2.makeCli)();
607
- const context = (0, fixtures_1.createMockContext)();
608
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
609
- expect(prompt_1.requestAWSCredentials).toHaveBeenCalled();
610
- expect(code).toBe(1);
611
- const output = context.stdout.toString();
612
- expect(output).toMatchSnapshot();
613
- }));
614
- });
615
- describe('prompts for confirmation before sending', () => {
616
- beforeEach(() => {
617
- ;
618
- commons_1.getAWSCredentials.mockResolvedValue(fixtures_2.mockAwsCredentials);
619
- });
620
- it('sends when user answers prompt with yes', () => __awaiter(void 0, void 0, void 0, function* () {
621
- // The first prompt is for additional files, the second is for confirmation before sending
622
- jest.spyOn(helpersPromptModule, 'requestConfirmation').mockResolvedValueOnce(true).mockResolvedValueOnce(true);
623
- const cli = (0, fixtures_2.makeCli)();
624
- const context = (0, fixtures_1.createMockContext)();
625
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
626
- expect(code).toBe(0);
627
- const output = context.stdout.toString();
628
- expect(output).toMatchSnapshot();
629
- expect(output).toContain('✅ Successfully sent flare file to Datadog Support!');
630
- }));
631
- it('does not send when user answers prompt with no', () => __awaiter(void 0, void 0, void 0, function* () {
632
- // The first prompt is for additional files, the second is for confirmation before sending
633
- jest.spyOn(helpersPromptModule, 'requestConfirmation').mockResolvedValueOnce(true).mockResolvedValueOnce(false);
634
- const cli = (0, fixtures_2.makeCli)();
635
- const context = (0, fixtures_1.createMockContext)();
636
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
637
- expect(code).toBe(0);
638
- const output = context.stdout.toString();
639
- expect(output).toMatchSnapshot();
640
- expect(output).toContain('🚫 The flare files were not sent based on your selection.');
641
- }));
642
- });
643
- describe('prompts for additional files', () => {
644
- beforeEach(() => {
645
- ;
646
- commons_1.getAWSCredentials.mockResolvedValue(fixtures_2.mockAwsCredentials);
647
- });
648
- it('requests additional files when user answers yes', () => __awaiter(void 0, void 0, void 0, function* () {
649
- // The first prompt is for additional files, the second is for confirmation before sending
650
- jest.spyOn(helpersPromptModule, 'requestConfirmation').mockResolvedValueOnce(true).mockResolvedValueOnce(true);
651
- const cli = (0, fixtures_2.makeCli)();
652
- const context = (0, fixtures_1.createMockContext)();
653
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
654
- expect(code).toBe(0);
655
- const output = context.stdout.toString();
656
- expect(output).toMatchSnapshot();
657
- expect(output).toContain('[!] No additional files specified.');
658
- }));
659
- it('does not request additional files when user answers no', () => __awaiter(void 0, void 0, void 0, function* () {
660
- // The first prompt is for additional files, the second is for confirmation before sending
661
- jest.spyOn(helpersPromptModule, 'requestConfirmation').mockResolvedValueOnce(false).mockResolvedValueOnce(true);
662
- const cli = (0, fixtures_2.makeCli)();
663
- const context = (0, fixtures_1.createMockContext)();
664
- const code = yield cli.run(MOCK_REQUIRED_FLAGS, context);
665
- expect(code).toBe(0);
666
- const output = context.stdout.toString();
667
- expect(output).toMatchSnapshot();
668
- expect(output).not.toContain('Added 0 custom file(s)');
669
- }));
670
- });
671
- describe('getUniqueFilesNames', () => {
672
- it('should return file names when all are unique', () => {
673
- const mockFilePaths = new Set(['src/serverless.yml', 'src/package.json']);
674
- const expectedFiles = new Map([
675
- ['src/serverless.yml', 'serverless.yml'],
676
- ['src/package.json', 'package.json'],
677
- ]);
678
- const result = (0, flare_1.getUniqueFileNames)(mockFilePaths);
679
- expect(result).toEqual(expectedFiles);
680
- });
681
- it('returns unique file names when there are duplicates', () => {
682
- const mockFilePaths = new Set([
683
- 'src/func1/serverless.yml',
684
- 'src/func2/serverless.yml',
685
- 'src/func1/package.json',
686
- 'src/func2/package.json',
687
- 'src/Dockerfile',
688
- 'src/README.md',
689
- ]);
690
- const expectedFiles = new Map([
691
- ['src/func1/serverless.yml', 'src-func1-serverless.yml'],
692
- ['src/func2/serverless.yml', 'src-func2-serverless.yml'],
693
- ['src/func1/package.json', 'src-func1-package.json'],
694
- ['src/func2/package.json', 'src-func2-package.json'],
695
- ['src/Dockerfile', 'Dockerfile'],
696
- ['src/README.md', 'README.md'],
697
- ]);
698
- const result = (0, flare_1.getUniqueFileNames)(mockFilePaths);
699
- expect(result).toEqual(expectedFiles);
700
- });
701
- it('returns unique file names when there are duplicates with different prefixes', () => {
702
- const mockFilePaths = new Set([
703
- 'project1/src/func1/serverless.yml',
704
- 'project1/src/func2/serverless.yml',
705
- 'project2/src/func1/serverless.yml',
706
- 'project2/src/func2/serverless.yml',
707
- 'project2/src/func3/serverless.yml',
708
- 'project3/src/cool_function/serverless.yml',
709
- 'src/Dockerfile',
710
- 'src/README.md',
711
- ]);
712
- const expectedFiles = new Map([
713
- ['project1/src/func1/serverless.yml', 'project1-src-func1-serverless.yml'],
714
- ['project1/src/func2/serverless.yml', 'project1-src-func2-serverless.yml'],
715
- ['project2/src/func1/serverless.yml', 'project2-src-func1-serverless.yml'],
716
- ['project2/src/func2/serverless.yml', 'project2-src-func2-serverless.yml'],
717
- ['project2/src/func3/serverless.yml', 'project2-src-func3-serverless.yml'],
718
- ['project3/src/cool_function/serverless.yml', 'project3-src-cool_function-serverless.yml'],
719
- ['src/Dockerfile', 'Dockerfile'],
720
- ['src/README.md', 'README.md'],
721
- ]);
722
- const result = (0, flare_1.getUniqueFileNames)(mockFilePaths);
723
- expect(result).toEqual(expectedFiles);
724
- });
725
- });
726
- test('summarizeConfig', () => {
727
- expect((0, flare_1.summarizeConfig)(fixtures_2.MOCK_LAMBDA_CONFIG)).toMatchSnapshot();
728
- });
729
- });
730
- //# sourceMappingURL=flare.test.js.map