@aws-cdk-testing/cli-integ 3.5.0 → 3.6.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 (307) hide show
  1. package/lib/aws.js +6 -9
  2. package/lib/cli/query-github.js +2 -3
  3. package/lib/cli/run-suite.js +2 -3
  4. package/lib/cli/stage-distribution.js +4 -4
  5. package/lib/eventually.js +3 -3
  6. package/lib/files.js +2 -3
  7. package/lib/github.js +5 -6
  8. package/lib/integ-test.js +58 -3
  9. package/lib/package-sources/release-source.d.ts +1 -1
  10. package/lib/package-sources/release-source.js +2 -3
  11. package/lib/package-sources/repo-source.d.ts +1 -1
  12. package/lib/package-sources/repo-source.js +1 -1
  13. package/lib/package-sources/repo-tools/npm.js +4 -5
  14. package/lib/package-sources/subprocess.d.ts +1 -1
  15. package/lib/package-sources/subprocess.js +1 -1
  16. package/lib/process.js +5 -6
  17. package/lib/proxy.d.ts +1 -1
  18. package/lib/proxy.js +2 -2
  19. package/lib/resource-pool.js +5 -3
  20. package/lib/shell.d.ts +3 -3
  21. package/lib/shell.js +8 -12
  22. package/lib/staging/codeartifact.js +8 -11
  23. package/lib/staging/maven.d.ts +2 -2
  24. package/lib/staging/maven.js +3 -5
  25. package/lib/staging/npm.d.ts +2 -2
  26. package/lib/staging/npm.js +1 -1
  27. package/lib/staging/nuget.d.ts +2 -2
  28. package/lib/staging/nuget.js +1 -1
  29. package/lib/staging/parallel-shell.js +2 -2
  30. package/lib/staging/pypi.d.ts +2 -2
  31. package/lib/staging/pypi.js +1 -1
  32. package/lib/with-aws.d.ts +2 -2
  33. package/lib/with-aws.js +5 -4
  34. package/lib/with-cdk-app.d.ts +7 -5
  35. package/lib/with-cdk-app.js +28 -33
  36. package/lib/with-cli-lib.d.ts +4 -3
  37. package/lib/with-cli-lib.js +1 -1
  38. package/lib/with-packages.d.ts +1 -1
  39. package/lib/with-packages.js +1 -1
  40. package/lib/with-sam.d.ts +3 -3
  41. package/lib/with-sam.js +4 -7
  42. package/lib/with-temporary-directory.d.ts +1 -1
  43. package/lib/with-temporary-directory.js +1 -1
  44. package/lib/xpmutex.js +5 -3
  45. package/npm-shrinkwrap.json +8722 -0
  46. package/package.json +11 -7
  47. package/resources/cdk-apps/refactoring/cdk.json +7 -0
  48. package/resources/cdk-apps/refactoring/refactoring.js +18 -0
  49. package/test-reports/junit.xml +15 -0
  50. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.js +11 -11
  51. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.js +9 -9
  52. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.js +2 -3
  53. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.js +2 -3
  54. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.js +2 -3
  55. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.js +2 -3
  56. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.js +2 -3
  57. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.js +4 -6
  58. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.js +2 -3
  59. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.js +4 -5
  60. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.js +2 -3
  61. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.js +1 -1
  62. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.js +2 -3
  63. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.js +3 -4
  64. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.js +3 -4
  65. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.js +2 -3
  66. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.js +2 -3
  67. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.js +2 -3
  68. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.js +2 -3
  69. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.js +2 -3
  70. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.js +3 -4
  71. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.js +2 -3
  72. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.js +2 -3
  73. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.js +2 -3
  74. package/tests/cli-integ-tests/cdk-deploy.integtest.js +2 -3
  75. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.js +6 -7
  76. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.js +4 -5
  77. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.js +2 -2
  78. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.js +6 -5
  79. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.js +2 -3
  80. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.js +3 -4
  81. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.js +3 -4
  82. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.js +3 -4
  83. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.js +5 -6
  84. package/tests/cli-integ-tests/cdk-import-interactive.integtest.js +5 -6
  85. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.js +2 -3
  86. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.js +1 -2
  87. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.js +1 -1
  88. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.js +1 -1
  89. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.js +1 -1
  90. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.js +1 -1
  91. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.js +1 -1
  92. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.js +1 -1
  93. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.js +1 -1
  94. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.js +1 -1
  95. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.js +1 -1
  96. package/tests/cli-integ-tests/cdk-migrate/testcase.d.ts +1 -1
  97. package/tests/cli-integ-tests/cdk-migrate/testcase.js +4 -6
  98. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.js +2 -3
  99. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.d.ts +1 -0
  100. package/tests/cli-integ-tests/cdk-refactor-dry-run.integtest.js +41 -0
  101. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.js +2 -3
  102. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.js +5 -6
  103. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.js +4 -4
  104. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.js +5 -6
  105. package/tests/cli-integ-tests/proxy.integtest.js +2 -3
  106. package/tests/init-go/init-go.integtest.js +2 -3
  107. package/tests/init-typescript-app/init-typescript-app.integtest.js +1 -1
  108. package/tests/tool-integrations/amplify.integtest.js +4 -4
  109. package/tests/tool-integrations/with-tool-context.d.ts +5 -5
  110. package/tests/tool-integrations/with-tool-context.js +1 -1
  111. package/.eslintrc.js +0 -9
  112. package/lib/aws.ts +0 -303
  113. package/lib/cli/query-github.ts +0 -56
  114. package/lib/cli/run-suite.ts +0 -153
  115. package/lib/cli/stage-distribution.ts +0 -262
  116. package/lib/cli/test-root.ts +0 -3
  117. package/lib/corking.ts +0 -33
  118. package/lib/eventually.ts +0 -42
  119. package/lib/files.ts +0 -80
  120. package/lib/github.ts +0 -43
  121. package/lib/index.ts +0 -13
  122. package/lib/integ-test.ts +0 -110
  123. package/lib/lists.ts +0 -9
  124. package/lib/memoize.ts +0 -14
  125. package/lib/npm.ts +0 -41
  126. package/lib/package-sources/release-source.ts +0 -82
  127. package/lib/package-sources/repo-source.ts +0 -112
  128. package/lib/package-sources/repo-tools/npm.ts +0 -48
  129. package/lib/package-sources/source.ts +0 -35
  130. package/lib/package-sources/subprocess.ts +0 -15
  131. package/lib/process.ts +0 -154
  132. package/lib/proxy.ts +0 -64
  133. package/lib/resource-pool.ts +0 -140
  134. package/lib/resources.ts +0 -4
  135. package/lib/shell.ts +0 -331
  136. package/lib/staging/codeartifact.ts +0 -387
  137. package/lib/staging/maven.ts +0 -95
  138. package/lib/staging/npm.ts +0 -62
  139. package/lib/staging/nuget.ts +0 -75
  140. package/lib/staging/parallel-shell.ts +0 -51
  141. package/lib/staging/pypi.ts +0 -50
  142. package/lib/staging/usage-dir.ts +0 -99
  143. package/lib/with-aws.ts +0 -111
  144. package/lib/with-cdk-app.ts +0 -847
  145. package/lib/with-cli-lib.ts +0 -150
  146. package/lib/with-packages.ts +0 -15
  147. package/lib/with-sam.ts +0 -295
  148. package/lib/with-temporary-directory.ts +0 -35
  149. package/lib/with-timeout.ts +0 -33
  150. package/lib/xpmutex.ts +0 -218
  151. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +0 -19
  152. package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +0 -134
  153. package/tests/cli-integ-tests/cdk---exclusively-selects-only-selected-stack.integtest.ts +0 -29
  154. package/tests/cli-integ-tests/cdk-assets/cdk-assets-uses-profile.integtest.ts +0 -92
  155. package/tests/cli-integ-tests/cdk-assets/smoketest.integtest.ts +0 -82
  156. package/tests/cli-integ-tests/cdk-automatic-ordering-with-concurrency.integtest.ts +0 -15
  157. package/tests/cli-integ-tests/cdk-automatic-ordering.integtest.ts +0 -15
  158. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and---no-rollback-is-removed-from-flags.integtest.ts +0 -40
  159. package/tests/cli-integ-tests/cdk-automatic-rollback-if-paused-and-change-contains-a-replacement.integtest.ts +0 -40
  160. package/tests/cli-integ-tests/cdk-automatic-rollback-if-replacement-and---no-rollback-is-removed-from-flags.integtest.ts +0 -29
  161. package/tests/cli-integ-tests/cdk-bootstrap-a-customized-template-vendor-will-not-overwrite-the-default-template.integtest.ts +0 -42
  162. package/tests/cli-integ-tests/cdk-bootstrap-add-tags.integtest.ts +0 -26
  163. package/tests/cli-integ-tests/cdk-bootstrap-can-add-tags-then-update-tags-during-re-bootstrap.integtest.ts +0 -28
  164. package/tests/cli-integ-tests/cdk-bootstrap-can-and-deploy-if-omitting-execution-policies.integtest.ts +0 -21
  165. package/tests/cli-integ-tests/cdk-bootstrap-can-bootstrap-without-execution.integtest.ts +0 -22
  166. package/tests/cli-integ-tests/cdk-bootstrap-can-create-a-legacy-bootstrap-stack-with---public-access-block-configuration-false.integtest.ts +0 -21
  167. package/tests/cli-integ-tests/cdk-bootstrap-can-create-multiple-legacy-bootstrap-stacks.integtest.ts +0 -27
  168. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-modern-synthesized-stack-even-if-bootstrap-stack-name-is-unknown.integtest.ts +0 -24
  169. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-with-session-tags-on-the-deploy.integtest.ts +0 -25
  170. package/tests/cli-integ-tests/cdk-bootstrap-can-deploy-without-execution-role-and-with-session-tags-on-deploy-role.integtest.ts +0 -22
  171. package/tests/cli-integ-tests/cdk-bootstrap-can-dump-the-template.integtest.ts +0 -32
  172. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-custompermissionsboundary.integtest.ts +0 -77
  173. package/tests/cli-integ-tests/cdk-bootstrap-can-remove-trusted-account.integtest.ts +0 -30
  174. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-(with-slashes)-to-bootstrap.integtest.ts +0 -15
  175. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-custom-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  176. package/tests/cli-integ-tests/cdk-bootstrap-can-use-the-default-permissions-boundary-to-bootstrap.integtest.ts +0 -15
  177. package/tests/cli-integ-tests/cdk-bootstrap-create-ecr-with-tag-immutability-to-set-on.integtest.ts +0 -34
  178. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap-(with-docker-image).integtest.ts +0 -22
  179. package/tests/cli-integ-tests/cdk-bootstrap-deploy-new-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -22
  180. package/tests/cli-integ-tests/cdk-bootstrap-deploy-old-style-synthesis-to-new-style-bootstrap.integtest.ts +0 -21
  181. package/tests/cli-integ-tests/cdk-bootstrap-switch-on-termination-protection.integtest.ts +0 -24
  182. package/tests/cli-integ-tests/cdk-bootstrap-upgrade-legacy-bootstrap-stack-to-new-bootstrap-stack-while-in-use.integtest.ts +0 -47
  183. package/tests/cli-integ-tests/cdk-can-still-load-old-assemblies.integtest.ts +0 -57
  184. package/tests/cli-integ-tests/cdk-cdk-diff---fail-on-multiple-stacks-exits-with-error-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  185. package/tests/cli-integ-tests/cdk-cdk-diff---fail-with-multiple-stack-exits-with-if-any-of-the-stacks-contains-a-diff.integtest.ts +0 -22
  186. package/tests/cli-integ-tests/cdk-cdk-diff---quiet-does-not-print-there-were-no-differences-message-for-stacks-which-have-no-differences.integtest.ts +0 -19
  187. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-changes-are-present.integtest.ts +0 -14
  188. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-access-control-config.integtest.ts +0 -13
  189. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-assignment.integtest.ts +0 -13
  190. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-with-managed-policy.integtest.ts +0 -13
  191. package/tests/cli-integ-tests/cdk-cdk-diff---security-only---fail-exits-when-security-diff-for-sso-perm-set-without-managed-policy.integtest.ts +0 -13
  192. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-access-control-information.integtest.ts +0 -35
  193. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-assignment-information.integtest.ts +0 -37
  194. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-with-managed-policy-information.integtest.ts +0 -35
  195. package/tests/cli-integ-tests/cdk-cdk-diff---security-only-successfully-outputs-sso-permission-set-without-managed-policy-information.integtest.ts +0 -37
  196. package/tests/cli-integ-tests/cdk-cdk-diff-doesnt-show-resource-metadata-changes.integtest.ts +0 -23
  197. package/tests/cli-integ-tests/cdk-cdk-diff-shows-resource-metadata-changes-with---no-change-set.integtest.ts +0 -23
  198. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-and-custom-toolkit-stack-name-and-qualifier-does-not-fail.integtest.ts +0 -39
  199. package/tests/cli-integ-tests/cdk-cdk-diff-with-large-changeset-does-not-fail.integtest.ts +0 -28
  200. package/tests/cli-integ-tests/cdk-cdk-diff.integtest.ts +0 -18
  201. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json---long.integtest.ts +0 -50
  202. package/tests/cli-integ-tests/cdk-cdk-ls---show-dependencies---json.integtest.ts +0 -95
  203. package/tests/cli-integ-tests/cdk-cdk-ls.integtest.ts +0 -36
  204. package/tests/cli-integ-tests/cdk-cdk-notices-are-displayed-correctly.integtest.ts +0 -42
  205. package/tests/cli-integ-tests/cdk-cdk-notices-with---unacknowledged.integtest.ts +0 -14
  206. package/tests/cli-integ-tests/cdk-cdk-synth-add-the-metadata-properties-expected-by-sam.integtest.ts +0 -126
  207. package/tests/cli-integ-tests/cdk-cdk-synth-bundled-functions-as-expected.integtest.ts +0 -80
  208. package/tests/cli-integ-tests/cdk-cdk-synth.integtest.ts +0 -53
  209. package/tests/cli-integ-tests/cdk-ci-output-to-stderr.integtest.ts +0 -19
  210. package/tests/cli-integ-tests/cdk-ci-true-output-to-stdout.integtest.ts +0 -28
  211. package/tests/cli-integ-tests/cdk-construct-with-builtin-lambda-function.integtest.ts +0 -14
  212. package/tests/cli-integ-tests/cdk-context-in-stage-propagates-to-top.integtest.ts +0 -20
  213. package/tests/cli-integ-tests/cdk-context-setting.integtest.ts +0 -33
  214. package/tests/cli-integ-tests/cdk-deploy---method-direct.integtest.ts +0 -23
  215. package/tests/cli-integ-tests/cdk-deploy-all-concurrently.integtest.ts +0 -17
  216. package/tests/cli-integ-tests/cdk-deploy-all.integtest.ts +0 -14
  217. package/tests/cli-integ-tests/cdk-deploy-and-test-stack-with-lambda-asset.integtest.ts +0 -31
  218. package/tests/cli-integ-tests/cdk-deploy-deletes-all-notification-arns-when-empty-array-is-passed.integtest.ts +0 -50
  219. package/tests/cli-integ-tests/cdk-deploy-no-stacks-error.integtest.ts +0 -18
  220. package/tests/cli-integ-tests/cdk-deploy-no-stacks-with---ignore-no-stacks.integtest.ts +0 -17
  221. package/tests/cli-integ-tests/cdk-deploy-preserves-existing-notification-arns-when-not-specified.integtest.ts +0 -51
  222. package/tests/cli-integ-tests/cdk-deploy-stack-with-docker-asset.integtest.ts +0 -11
  223. package/tests/cli-integ-tests/cdk-deploy-stack-with-lambda-asset-to-object-lock-enabled-asset-bucket.integtest.ts +0 -42
  224. package/tests/cli-integ-tests/cdk-deploy-stack-without-resource.integtest.ts +0 -32
  225. package/tests/cli-integ-tests/cdk-deploy-wildcard-with-outputs.integtest.ts +0 -28
  226. package/tests/cli-integ-tests/cdk-deploy-with-import-existing-resources-true.integtest.ts +0 -29
  227. package/tests/cli-integ-tests/cdk-deploy-with-method-direct-and-import-existing-resources-fails.integtest.ts +0 -17
  228. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-flag.integtest.ts +0 -36
  229. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop-and-flag.integtest.ts +0 -45
  230. package/tests/cli-integ-tests/cdk-deploy-with-notification-arn-as-prop.integtest.ts +0 -37
  231. package/tests/cli-integ-tests/cdk-deploy-with-parameters-multi.integtest.ts +0 -33
  232. package/tests/cli-integ-tests/cdk-deploy-with-parameters.integtest.ts +0 -26
  233. package/tests/cli-integ-tests/cdk-deploy-with-role.integtest.ts +0 -119
  234. package/tests/cli-integ-tests/cdk-deploy-with-wildcard-and-parameters.integtest.ts +0 -22
  235. package/tests/cli-integ-tests/cdk-deploy-without-execute-a-named-change-set.integtest.ts +0 -36
  236. package/tests/cli-integ-tests/cdk-deploy-without-import-existing-resources.integtest.ts +0 -28
  237. package/tests/cli-integ-tests/cdk-deploy.integtest.ts +0 -20
  238. package/tests/cli-integ-tests/cdk-destroy-interactive.integtest.ts +0 -36
  239. package/tests/cli-integ-tests/cdk-doubly-nested-stack.integtest.ts +0 -12
  240. package/tests/cli-integ-tests/cdk-enablediffnofail.integtest.ts +0 -44
  241. package/tests/cli-integ-tests/cdk-failed-deploy-does-not-hang.integtest.ts +0 -12
  242. package/tests/cli-integ-tests/cdk-fast-deploy.integtest.ts +0 -41
  243. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-ecr-images.integtest.ts +0 -48
  244. package/tests/cli-integ-tests/cdk-gc-garbage-collection-deletes-unused-s3-objects.integtest.ts +0 -51
  245. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-ecr-images.integtest.ts +0 -48
  246. package/tests/cli-integ-tests/cdk-gc-garbage-collection-keeps-in-use-s3-objects.integtest.ts +0 -52
  247. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-ecr-images.integtest.ts +0 -47
  248. package/tests/cli-integ-tests/cdk-gc-garbage-collection-tags-unused-s3-objects.integtest.ts +0 -63
  249. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-ecr-images.integtest.ts +0 -55
  250. package/tests/cli-integ-tests/cdk-gc-garbage-collection-untags-in-use-s3-objects.integtest.ts +0 -63
  251. package/tests/cli-integ-tests/cdk-generating-and-loading-assembly.integtest.ts +0 -52
  252. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-detects-failed-deployment-and-errors.integtest.ts +0 -29
  253. package/tests/cli-integ-tests/cdk-hotswap-deployment-for-ecs-service-waits-for-deployment-to-complete.integtest.ts +0 -45
  254. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-appsync-apis-with-many-functions.integtest.ts +0 -36
  255. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-ecs-service.integtest.ts +0 -41
  256. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-fn::importvalue-intrinsic.integtest.ts +0 -53
  257. package/tests/cli-integ-tests/cdk-hotswap-deployment-supports-lambda-functions-description-and-environment-variables.integtest.ts +0 -43
  258. package/tests/cli-integ-tests/cdk-hotswap-ecs-deployment-respects-properties-override.integtest.ts +0 -59
  259. package/tests/cli-integ-tests/cdk-iam-diff.integtest.ts +0 -23
  260. package/tests/cli-integ-tests/cdk-import-interactive.integtest.ts +0 -57
  261. package/tests/cli-integ-tests/cdk-lib-cli-lib-deploy.integtest.ts +0 -32
  262. package/tests/cli-integ-tests/cdk-lib-cli-lib-list.integtest.ts +0 -12
  263. package/tests/cli-integ-tests/cdk-lib-cli-lib-synth.integtest.ts +0 -27
  264. package/tests/cli-integ-tests/cdk-lib-security-related-changes-without-a-cli-are-expected-to-fail-when-approval-is-required.integtest.ts +0 -32
  265. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-csharp.integtest.ts +0 -13
  266. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-java.integtest.ts +0 -14
  267. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-python.integtest.ts +0 -13
  268. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate--from-stack-creates-deployable-app-typescript.integtest.ts +0 -13
  269. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-csharp.integtest.ts +0 -15
  270. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-java.integtest.ts +0 -15
  271. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-python.integtest.ts +0 -15
  272. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-deploys-successfully-typescript.integtest.ts +0 -15
  273. package/tests/cli-integ-tests/cdk-migrate/cdk-migrate-generates-migrate.json.integtest.ts +0 -20
  274. package/tests/cli-integ-tests/cdk-migrate/testcase.ts +0 -69
  275. package/tests/cli-integ-tests/cdk-nested-stack-with-parameters.integtest.ts +0 -28
  276. package/tests/cli-integ-tests/cdk-requests-go-through-a-proxy-when-configured.integtest.ts +0 -39
  277. package/tests/cli-integ-tests/cdk-sam-can-locally-test-the-synthesized-cdk-application.integtest.ts +0 -25
  278. package/tests/cli-integ-tests/cdk-security-related-changes-without-a-cli-are-expected-to-fail.integtest.ts +0 -30
  279. package/tests/cli-integ-tests/cdk-skips-notice-refresh.integtest.ts +0 -26
  280. package/tests/cli-integ-tests/cdk-ssm-parameter-provider-error.integtest.ts +0 -18
  281. package/tests/cli-integ-tests/cdk-stack-in-update_rollback_complete-state-can-be-updated.integtest.ts +0 -59
  282. package/tests/cli-integ-tests/cdk-stage-with-bundled-lambda-function.integtest.ts +0 -13
  283. package/tests/cli-integ-tests/cdk-synth---quiet-can-be-specified-in-cdk.json.integtest.ts +0 -20
  284. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-can-be-suppressed.integtest.ts +0 -15
  285. package/tests/cli-integ-tests/cdk-synthing-a-stage-with-errors-leads-to-failure.integtest.ts +0 -18
  286. package/tests/cli-integ-tests/cdk-templates-on-disk-contain-metadata-resource.integtest.ts +0 -25
  287. package/tests/cli-integ-tests/cdk-termination-protection.integtest.ts +0 -19
  288. package/tests/cli-integ-tests/cdk-test-cdk-rollback---force.integtest.ts +0 -48
  289. package/tests/cli-integ-tests/cdk-test-cdk-rollback.integtest.ts +0 -38
  290. package/tests/cli-integ-tests/cdk-test-migrate-deployment-for-app-with-localfile-source-in-migrate.json.integtest.ts +0 -56
  291. package/tests/cli-integ-tests/cdk-test-resource-import-with-construct-that-requires-bundling.integtest.ts +0 -74
  292. package/tests/cli-integ-tests/cdk-test-resource-import.integtest.ts +0 -64
  293. package/tests/cli-integ-tests/cdk-two-ways-of-showing-the-version.integtest.ts +0 -14
  294. package/tests/cli-integ-tests/cdk-update-to-stack-in-rollback_complete-state-will-delete-stack-and-create-a-new-one.integtest.ts +0 -47
  295. package/tests/cli-integ-tests/cdk-vpc-lookup.integtest.ts +0 -26
  296. package/tests/cli-integ-tests/proxy.integtest.ts +0 -168
  297. package/tests/init-csharp/init-csharp.integtest.ts +0 -15
  298. package/tests/init-fsharp/init-fsharp.integtest.ts +0 -15
  299. package/tests/init-go/init-go.integtest.ts +0 -28
  300. package/tests/init-java/init-java.integtest.ts +0 -14
  301. package/tests/init-javascript/init-javascript.integtest.ts +0 -58
  302. package/tests/init-python/init-python.integtest.ts +0 -20
  303. package/tests/init-typescript-app/init-typescript-app.integtest.ts +0 -67
  304. package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +0 -13
  305. package/tests/tool-integrations/amplify.integtest.ts +0 -117
  306. package/tests/tool-integrations/with-tool-context.ts +0 -14
  307. package/tests/uberpackage/uberpackage.integtest.ts +0 -11
@@ -1,262 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as path from 'path';
3
- import * as fs from 'fs-extra';
4
- import * as glob from 'glob';
5
- import * as yargs from 'yargs';
6
- import { shell } from '..';
7
- import { TestRepository } from '../staging/codeartifact';
8
- import { uploadJavaPackages, mavenLogin } from '../staging/maven';
9
- import { uploadNpmPackages, npmLogin } from '../staging/npm';
10
- import { uploadDotnetPackages, nugetLogin } from '../staging/nuget';
11
- import { uploadPythonPackages, pypiLogin } from '../staging/pypi';
12
- import { UsageDir } from '../staging/usage-dir';
13
-
14
- async function main() {
15
- await yargs
16
- .usage('$0 <command>')
17
- .option('npm', {
18
- description: 'Upload NPM packages only',
19
- type: 'boolean',
20
- requiresArg: false,
21
- })
22
- .option('python', {
23
- description: 'Upload Python packages only',
24
- type: 'boolean',
25
- requiresArg: false,
26
- })
27
- .option('java', {
28
- description: 'Upload Java packages only',
29
- type: 'boolean',
30
- requiresArg: false,
31
- })
32
- .option('dotnet', {
33
- description: 'Upload Dotnet packages only',
34
- type: 'boolean',
35
- requiresArg: false,
36
- })
37
- .option('regression', {
38
- description: 'Enable access to previous versions of the staged packages (this is expensive for CodeArtifact so we only do it when necessary)',
39
- type: 'boolean',
40
- requiresArg: false,
41
- default: false,
42
- })
43
- .command('publish <DIRECTORY>', 'Publish a given directory', cmd => cmd
44
- .positional('DIRECTORY', {
45
- descripton: 'Directory distribution',
46
- type: 'string',
47
- demandOption: true,
48
- })
49
- .option('name', {
50
- alias: 'n',
51
- description: 'Name of the repository to create (default: generate unique name)',
52
- type: 'string',
53
- requiresArg: true,
54
- }), async (args) => {
55
- await validateDirectory(args);
56
- const repo = await (args.name ? TestRepository.newWithName(args.name) : TestRepository.newRandom());
57
- const usageDir = UsageDir.default();
58
-
59
- await doLogin(repo, usageDir, args);
60
- await publish(repo, usageDir, args);
61
-
62
- header('Done');
63
- usageDir.advertise();
64
- })
65
- .command('login', 'Login to a given repository', cmd => cmd
66
- .option('name', {
67
- alias: 'n',
68
- description: 'Name of the repository to log in to',
69
- type: 'string',
70
- requiresArg: true,
71
- demandOption: true,
72
- }), async (args) => {
73
- const repo = TestRepository.existing(args.name);
74
- const usageDir = UsageDir.default();
75
-
76
- await doLogin(repo, usageDir, args);
77
-
78
- usageDir.advertise();
79
- })
80
- .command('run <DIRECTORY> <COMMAND..>', 'Publish and run a command', cmd => cmd
81
- .positional('DIRECTORY', {
82
- descripton: 'Directory distribution',
83
- type: 'string',
84
- demandOption: true,
85
- })
86
- .positional('COMMAND', {
87
- alias: 'c',
88
- description: 'Run the given command with the packages staged',
89
- type: 'string',
90
- array: true,
91
- demandOption: true,
92
- })
93
- .option('cleanup', {
94
- alias: 'C',
95
- description: 'Cleanup the repository afterwards',
96
- type: 'boolean',
97
- default: true,
98
- requiresArg: false,
99
- }), async (args) => {
100
- await validateDirectory(args);
101
- const repo = await TestRepository.newRandom();
102
- const usageDir = UsageDir.default();
103
-
104
- await doLogin(repo, usageDir, args);
105
- await publish(repo, usageDir, args);
106
-
107
- try {
108
- await usageDir.activateInCurrentProcess();
109
-
110
- await shell(args.COMMAND ?? [], {
111
- shell: true,
112
- show: 'always',
113
- });
114
- } finally {
115
- if (args.cleanup) {
116
- await repo.delete();
117
- }
118
- }
119
- })
120
- .command('cleanup', 'Clean up testing repository', cmd => cmd
121
- .option('name', {
122
- alias: 'n',
123
- description: 'Name of the repository to cleanup (default: most recent)',
124
- type: 'string',
125
- requiresArg: true,
126
- }), async (args) => {
127
- const usageDir = UsageDir.default();
128
-
129
- let repositoryName = args.name;
130
- if (!repositoryName) {
131
- repositoryName = (await usageDir.currentEnv()).CODEARTIFACT_REPO;
132
- }
133
-
134
- if (!repositoryName) {
135
- console.log(`No --name given and no $CODEARTIFACT_REPO found in ${usageDir.directory}, nothing cleaned up`);
136
- return;
137
- }
138
-
139
- const repo = TestRepository.existing(repositoryName);
140
- await repo.delete();
141
- })
142
- .command('gc', 'Clean up day-old testing repositories', cmd => cmd, async () => {
143
- await TestRepository.gc();
144
- })
145
- .demandCommand(1, 'You must supply a command')
146
- .help()
147
- .showHelpOnFail(false)
148
- .parse();
149
- }
150
-
151
- async function validateDirectory(args: {
152
- DIRECTORY: string;
153
- }) {
154
- if (!await fs.pathExists(path.join(args.DIRECTORY, 'build.json'))) {
155
- throw new Error(`${args.DIRECTORY} does not look like a CDK dist directory (build.json missing)`);
156
- }
157
- }
158
-
159
- async function doLogin(repo: TestRepository, usageDir: UsageDir, args: {
160
- npm?: boolean;
161
- python?: boolean;
162
- java?: boolean;
163
- dotnet?: boolean;
164
- }) {
165
- const login = await repo.loginInformation();
166
-
167
- const oldEnv = await usageDir.currentEnv();
168
-
169
- await usageDir.clean();
170
- await usageDir.addToEnv({
171
- CODEARTIFACT_REPO: login.repositoryName,
172
- });
173
-
174
- if (oldEnv.BUILD_VERSION) {
175
- await usageDir.addToEnv({
176
- BUILD_VERSION: oldEnv.BUILD_VERSION,
177
- });
178
- }
179
-
180
- const doRepo = whichRepos(args);
181
-
182
- await doRepo.npm(() => npmLogin(login, usageDir));
183
- await doRepo.python(() => pypiLogin(login, usageDir));
184
- await doRepo.java(() => mavenLogin(login, usageDir));
185
- await doRepo.dotnet(() => nugetLogin(login, usageDir));
186
- }
187
-
188
- async function publish(repo: TestRepository, usageDir: UsageDir, args: {
189
- DIRECTORY: string;
190
- npm?: boolean;
191
- python?: boolean;
192
- java?: boolean;
193
- dotnet?: boolean;
194
- regression?: boolean;
195
- }) {
196
- const directory = `${args.DIRECTORY}`;
197
- const login = await repo.loginInformation();
198
-
199
- const doRepo = whichRepos(args);
200
-
201
- const buildJson = await fs.readJson(path.join(directory, 'build.json'));
202
- await usageDir.addToEnv({
203
- BUILD_VERSION: buildJson.version,
204
- });
205
-
206
- await doRepo.npm(async () => {
207
- header('NPM');
208
- await uploadNpmPackages(glob.sync(path.join(directory, 'js', '*.tgz')), login, usageDir);
209
- });
210
-
211
- await doRepo.python(async () => {
212
- header('Python');
213
- await uploadPythonPackages(glob.sync(path.join(directory, 'python', '*')), login);
214
- });
215
-
216
- await doRepo.java(async () => {
217
- header('Java');
218
- await uploadJavaPackages(glob.sync(path.join(directory, 'java', '**', '*.pom')), login, usageDir);
219
- });
220
-
221
- await doRepo.dotnet(async () => {
222
- header('.NET');
223
- await uploadDotnetPackages(glob.sync(path.join(directory, 'dotnet', '**', '*.nupkg')), usageDir);
224
- });
225
-
226
- if (args.regression) {
227
- console.log('🛍 Configuring packages for upstream versions');
228
- await repo.markAllUpstreamAllow();
229
- }
230
- }
231
-
232
- function whichRepos(args: {
233
- npm?: boolean;
234
- python?: boolean;
235
- java?: boolean;
236
- dotnet?: boolean;
237
- }) {
238
- const all = args.npm === undefined && args.python === undefined && args.java === undefined && args.dotnet === undefined;
239
-
240
- const invoke = (block: () => Promise<void>) => block();
241
- const skip = () => { };
242
-
243
- return {
244
- npm: args.npm || all ? invoke : skip,
245
- python: args.python || all ? invoke : skip,
246
- java: args.java || all ? invoke : skip,
247
- dotnet: args.dotnet || all ? invoke : skip,
248
- };
249
- }
250
-
251
- function header(caption: string) {
252
- console.log('');
253
- console.log('/'.repeat(70));
254
- console.log(`// ${caption}`);
255
- console.log('');
256
- }
257
-
258
- main().catch(e => {
259
- // eslint-disable-next-line no-console
260
- console.error(e);
261
- process.exitCode = 1;
262
- });
@@ -1,3 +0,0 @@
1
- import * as path from 'path';
2
- // eslint-disable-next-line no-console
3
- console.log(path.resolve(__dirname, '..', '..'));
package/lib/corking.ts DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * Routines for corking stdout and stderr
3
- */
4
- import * as stream from 'stream';
5
-
6
- export class MemoryStream extends stream.Writable {
7
- private parts = new Array<Buffer>();
8
-
9
- public _write(chunk: Buffer, _encoding: string, callback: (error?: Error | null) => void): void {
10
- this.parts.push(chunk);
11
- callback();
12
- }
13
-
14
- public buffer() {
15
- return Buffer.concat(this.parts);
16
- }
17
-
18
- public clear() {
19
- this.parts.splice(0, this.parts.length);
20
- }
21
-
22
- public async flushTo(strm: NodeJS.WritableStream): Promise<void> {
23
- const flushed = strm.write(this.buffer());
24
- if (!flushed) {
25
- return new Promise(ok => strm.once('drain', ok));
26
- }
27
- return;
28
- }
29
-
30
- public toString() {
31
- return this.buffer().toString();
32
- }
33
- }
package/lib/eventually.ts DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * @param maxAttempts the maximum number of attempts
3
- * @param interval interval in milliseconds to observe between attempts
4
- */
5
- export type EventuallyOptions = {
6
- maxAttempts?: number;
7
- interval?: number;
8
- };
9
-
10
- const wait = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));
11
- const DEFAULT_INTERVAL = 1000;
12
- const DEFAULT_MAX_ATTEMPTS = 10;
13
-
14
- /**
15
- * Runs a function on an interval until the maximum number of attempts has
16
- * been reached.
17
- *
18
- * Default interval = 1000 milliseconds
19
- * Default maxAttempts = 10
20
- *
21
- * @param fn function to run
22
- * @param options EventuallyOptions
23
- */
24
- const eventually = async <T>(call: () => Promise<T>, options?: EventuallyOptions): Promise<T> => {
25
- const opts = {
26
- interval: options?.interval ? options.interval : DEFAULT_INTERVAL,
27
- maxAttempts: options?.maxAttempts ? options.maxAttempts : DEFAULT_MAX_ATTEMPTS,
28
- };
29
-
30
- while (opts.maxAttempts-- >= 0) {
31
- try {
32
- return await call();
33
- } catch (err) {
34
- if (opts.maxAttempts <= 0) throw err;
35
- }
36
- await wait(opts.interval);
37
- }
38
-
39
- throw new Error('An unexpected error has occurred.');
40
- };
41
-
42
- export default eventually;
package/lib/files.ts DELETED
@@ -1,80 +0,0 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- import * as fs from 'fs-extra';
4
-
5
- export async function rmFile(filename: string) {
6
- if (await fs.pathExists(filename)) {
7
- await fs.unlink(filename);
8
- }
9
- }
10
-
11
- export async function addToFile(filename: string, line: string) {
12
- let contents = await fs.pathExists(filename) ? await fs.readFile(filename, { encoding: 'utf-8' }) : '';
13
- if (!contents.endsWith('\n')) {
14
- contents += '\n';
15
- }
16
- contents += line + '\n';
17
-
18
- await writeFile(filename, contents);
19
- }
20
-
21
- export async function writeFile(filename: string, contents: string) {
22
- await fs.mkdirp(path.dirname(filename));
23
- await fs.writeFile(filename, contents, { encoding: 'utf-8' });
24
- }
25
-
26
- export async function copyDirectoryContents(dir: string, target: string) {
27
- for (const file of await fs.readdir(path.join(dir), { encoding: 'utf-8' })) {
28
- await fs.copyFile(path.join(dir, file), path.join(target, file));
29
- }
30
- }
31
-
32
- export function findUp(name: string, directory: string = process.cwd()): string | undefined {
33
- const absoluteDirectory = path.resolve(directory);
34
-
35
- const file = path.join(directory, name);
36
- if (fs.existsSync(file)) {
37
- return file;
38
- }
39
-
40
- const { root } = path.parse(absoluteDirectory);
41
- if (absoluteDirectory == root) {
42
- return undefined;
43
- }
44
-
45
- return findUp(name, path.dirname(absoluteDirectory));
46
- }
47
-
48
- /**
49
- * Docker-safe home directory
50
- */
51
- export function homeDir() {
52
- return os.userInfo().homedir ?? os.homedir();
53
- }
54
-
55
- export async function loadLines(filename: string): Promise<string[]> {
56
- return await fs.pathExists(filename) ? (await fs.readFile(filename, { encoding: 'utf-8' })).trim().split('\n') : [];
57
- }
58
-
59
- export async function writeLines(filename: string, lines: string[]) {
60
- // Must end in a newline or our bash script won't read it properly
61
- await fs.writeFile(filename, lines.join('\n') + '\n', { encoding: 'utf-8' });
62
- }
63
-
64
- /**
65
- * Update a spaceless ini file in place
66
- */
67
- export function updateIniKey(lines: string[], key: string, value: string) {
68
- const prefix = `${key}=`;
69
- let found = false;
70
- for (let i = 0; i < lines.length; i++) {
71
- if (lines[i].startsWith(prefix)) {
72
- lines[i] = prefix + value;
73
- found = true;
74
- break;
75
- }
76
- }
77
- if (!found) {
78
- lines.push(prefix + value);
79
- }
80
- }
package/lib/github.ts DELETED
@@ -1,43 +0,0 @@
1
- import { Octokit } from '@octokit/rest';
2
- import * as semver from 'semver';
3
-
4
- export async function fetchPreviousVersion(token: string, options?: {
5
- priorTo?: string;
6
- majorVersion?: string;
7
- }) {
8
- const github = new Octokit({ auth: token });
9
- const releases = await github.repos.listReleases({
10
- owner: 'aws',
11
- repo: 'aws-cdk',
12
- });
13
-
14
- // this returns a list in descending order, newest releases first
15
- // opts for same major version where possible, falling back otherwise
16
- // to previous major versions.
17
- let previousMVRelease = undefined;
18
- for (const release of releases.data) {
19
- const version = release.name?.replace('v', '');
20
- if (!version) { continue; }
21
-
22
- // Any old version is fine
23
- if (!options?.majorVersion && !options?.priorTo) {
24
- return version;
25
- }
26
-
27
- if (options?.majorVersion && `${semver.major(version)}` === options.majorVersion) {
28
- return version;
29
- }
30
-
31
- if (options?.priorTo && semver.lt(version, options?.priorTo) && semver.major(version) === semver.major(options.priorTo)) {
32
- return version;
33
- }
34
-
35
- // Otherwise return the most recent version that didn't match any
36
- if (!previousMVRelease) {
37
- previousMVRelease = version;
38
- }
39
- }
40
- if (previousMVRelease) { return previousMVRelease; }
41
-
42
- throw new Error(`Unable to find previous version given ${JSON.stringify(options)}`);
43
- }
package/lib/index.ts DELETED
@@ -1,13 +0,0 @@
1
- export * from './aws';
2
- export * from './corking';
3
- export * from './integ-test';
4
- export * from './memoize';
5
- export * from './resource-pool';
6
- export * from './with-cli-lib';
7
- export * from './with-sam';
8
- export * from './shell';
9
- export * from './with-aws';
10
- export * from './with-cdk-app';
11
- export * from './with-packages';
12
- export * from './with-temporary-directory';
13
- export * from './resources';
package/lib/integ-test.ts DELETED
@@ -1,110 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
- import { MemoryStream } from './corking';
4
-
5
- const SKIP_TESTS = fs.readFileSync(path.join(__dirname, '..', 'skip-tests.txt'), { encoding: 'utf-8' })
6
- .split('\n')
7
- .map(x => x.trim())
8
- .filter(x => x && !x.startsWith('#'));
9
-
10
- if (SKIP_TESTS.length > 0) {
11
- process.stderr.write(`ℹ️ Skipping tests: ${JSON.stringify(SKIP_TESTS)}\n`);
12
- }
13
-
14
- // Whether we want to stop after the first failure, for quicker debugging (hopefully).
15
- const FAIL_FAST = process.env.FAIL_FAST === 'true';
16
-
17
- // Keep track of whether the suite has failed. If so, we stop running.
18
- let failed = false;
19
-
20
- export interface TestContext {
21
- readonly randomString: string;
22
- readonly name: string;
23
- readonly output: NodeJS.WritableStream;
24
- log(s: string): void;
25
- }
26
-
27
- /**
28
- * A wrapper for jest's 'test' which takes regression-disabled tests into account and prints a banner
29
- */
30
- export function integTest(
31
- name: string,
32
- callback: (context: TestContext) => Promise<void>,
33
- timeoutMillis?: number,
34
- ): void {
35
- const runner = shouldSkip(name) ? test.skip : test;
36
-
37
- runner(name, async () => {
38
- const output = new MemoryStream();
39
-
40
- output.write('================================================================\n');
41
- output.write(`${name}\n`);
42
- output.write('================================================================\n');
43
-
44
- const now = Date.now();
45
- process.stderr.write(`[INTEG TEST::${name}] Starting (pid ${process.pid})...\n`);
46
- try {
47
- if (FAIL_FAST && failed) {
48
- throw new Error('FAIL_FAST requested and currently failing. Stopping test early.');
49
- }
50
-
51
- return await callback({
52
- output,
53
- randomString: randomString(),
54
- name,
55
- log(s: string) {
56
- output.write(`${s}\n`);
57
- },
58
- });
59
- } catch (e: any) {
60
- failed = true;
61
-
62
- // Print the buffered output, only if the test fails.
63
- output.write(e.message);
64
- output.write(e.stack);
65
- process.stderr.write(`[INTEG TEST::${name}] Failed: ${e}\n`);
66
-
67
- const isGitHub = !!process.env.GITHUB_RUN_ID;
68
-
69
- if (isGitHub) {
70
- // GitHub Actions compatible output formatting
71
- // https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-error-message
72
- let written = process.stderr.write(`::error title=Failed ${name}::${e.message}\n`);
73
- if (!written) {
74
- // Wait for drain
75
- await new Promise((ok) => process.stderr.once('drain', ok));
76
- }
77
-
78
- // Print output only if the test fails. Use 'console.log' so the output is buffered by
79
- // jest and prints without a stack trace (if verbose: false).
80
- written = process.stdout.write([
81
- `::group::Failure details: ${name} (click to expand)\n`,
82
- `${output.buffer().toString()}\n`,
83
- '::endgroup::\n',
84
- ].join(''));
85
- if (!written) {
86
- // Wait for drain
87
- await new Promise((ok) => process.stdout.once('drain', ok));
88
- }
89
- } else {
90
- // Use 'console.log' so the output is buffered by
91
- // jest and prints without a stack trace (if verbose: false).
92
- // eslint-disable-next-line no-console
93
- console.log(output.buffer().toString());
94
- }
95
- throw e;
96
- } finally {
97
- const duration = Date.now() - now;
98
- process.stderr.write(`[INTEG TEST::${name}] Done (${duration} ms).\n`);
99
- }
100
- }, timeoutMillis);
101
- }
102
-
103
- function shouldSkip(testName: string) {
104
- return SKIP_TESTS.includes(testName);
105
- }
106
-
107
- export function randomString() {
108
- // Crazy
109
- return Math.random().toString(36).replace(/[^a-z0-9]+/g, '');
110
- }
package/lib/lists.ts DELETED
@@ -1,9 +0,0 @@
1
- export function chunk<A>(n: number, xs: A[]): A[][] {
2
- const ret = new Array<A[]>();
3
-
4
- for (let i = 0; i < xs.length; i += n) {
5
- ret.push(xs.slice(i, i + n));
6
- }
7
-
8
- return ret;
9
- }
package/lib/memoize.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * Return a memoized version of an function with 0 arguments.
3
- *
4
- * Async-safe.
5
- */
6
- export function memoize0<A>(fn: () => Promise<A>): () => Promise<A> {
7
- let promise: Promise<A> | undefined;
8
- return () => {
9
- if (!promise) {
10
- promise = fn();
11
- }
12
- return promise;
13
- };
14
- }
package/lib/npm.ts DELETED
@@ -1,41 +0,0 @@
1
- import { spawnSync } from 'child_process';
2
-
3
- const MINIMUM_VERSION = '3.9';
4
-
5
- /**
6
- * Use NPM preinstalled on the machine to look up a list of TypeScript versions
7
- */
8
- export function typescriptVersionsSync(): string[] {
9
- const { stdout } = spawnSync('npm', ['--silent', 'view', `typescript@>=${MINIMUM_VERSION}`, 'version', '--json'], { encoding: 'utf-8' });
10
-
11
- const versions: string[] = JSON.parse(stdout);
12
- return Array.from(new Set(versions.map(v => v.split('.').slice(0, 2).join('.'))));
13
- }
14
-
15
- /**
16
- * Use NPM preinstalled on the machine to query publish times of versions
17
- */
18
- export function typescriptVersionsYoungerThanDaysSync(days: number, versions: string[]): string[] {
19
- const { stdout } = spawnSync('npm', ['--silent', 'view', 'typescript', 'time', '--json'], { encoding: 'utf-8' });
20
- const versionTsMap: Record<string, string> = JSON.parse(stdout);
21
-
22
- const cutoffDate = new Date(Date.now() - (days * 24 * 3600 * 1000));
23
- const cutoffDateS = cutoffDate.toISOString();
24
-
25
- const recentVersions = Object.entries(versionTsMap)
26
- .filter(([_, dateS]) => dateS > cutoffDateS)
27
- .map(([v]) => v);
28
-
29
- // Input versions are of the form 3.9, 5.2, etc.
30
- // Actual versions are of the form `3.9.15`, `5.3.0-dev.20511311`.
31
- // Return only 2-digit versions for which there is a non-prerelease version in the set of recentVersions
32
- // So a 2-digit versions that is followed by `.<digits>` until the end of the string.
33
- return versions.filter((twoV) => {
34
- const re = new RegExp(`^${reQuote(twoV)}\\.\\d+$`);
35
- return recentVersions.some(fullV => fullV.match(re));
36
- });
37
- }
38
-
39
- function reQuote(str: string): string {
40
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
41
- }