apify-test-tools 0.10.2-beta.1 → 0.10.2-beta.2

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 (70) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/actions/checkout-restore-dependencies/action.yaml +13 -29
  3. package/.github/cli/apify-test-tools.mjs +362 -0
  4. package/.github/scripts/run-with-apify-tokens.mjs +2 -2
  5. package/.github/workflows/_check_code.yaml +25 -0
  6. package/.github/workflows/_move_major_tag.yaml +3 -81
  7. package/.github/workflows/_tests.yaml +34 -0
  8. package/.github/workflows/_update_release_metadata.yaml +0 -12
  9. package/.github/workflows/manual_move_major_tag.yaml +3 -3
  10. package/.github/workflows/manual_release_stable.yaml +3 -13
  11. package/.github/workflows/on_master.yaml +9 -5
  12. package/.github/workflows/on_pull_request.yaml +3 -48
  13. package/.github/workflows/public_platform-tests.yaml +1 -1
  14. package/.github/workflows/public_pr-build-test.yaml +2 -2
  15. package/.github/workflows/public_push-build-latest.yaml +2 -2
  16. package/.husky/pre-commit +5 -0
  17. package/.prettierignore +3 -0
  18. package/CHANGELOG.md +4 -0
  19. package/CONTRIBUTING.md +8 -18
  20. package/README.md +39 -44
  21. package/bin/build-from-local.ts +47 -13
  22. package/bin/build.ts +35 -19
  23. package/bin/main.ts +20 -5
  24. package/bin/slack.ts +28 -6
  25. package/bin/test-report.ts +6 -9
  26. package/bin/types.ts +9 -0
  27. package/dist/bin/build-from-local.d.ts +10 -2
  28. package/dist/bin/build-from-local.d.ts.map +1 -1
  29. package/dist/bin/build-from-local.js +29 -11
  30. package/dist/bin/build-from-local.js.map +1 -1
  31. package/dist/bin/build.d.ts +15 -5
  32. package/dist/bin/build.d.ts.map +1 -1
  33. package/dist/bin/build.js +24 -15
  34. package/dist/bin/build.js.map +1 -1
  35. package/dist/bin/main.js +18 -4
  36. package/dist/bin/main.js.map +1 -1
  37. package/dist/bin/slack.d.ts +8 -1
  38. package/dist/bin/slack.d.ts.map +1 -1
  39. package/dist/bin/slack.js +26 -5
  40. package/dist/bin/slack.js.map +1 -1
  41. package/dist/bin/test-report.d.ts.map +1 -1
  42. package/dist/bin/test-report.js +6 -8
  43. package/dist/bin/test-report.js.map +1 -1
  44. package/dist/bin/types.d.ts +8 -0
  45. package/dist/bin/types.d.ts.map +1 -1
  46. package/dist/test/bundle/cli-bundle.test.d.ts +2 -0
  47. package/dist/test/bundle/cli-bundle.test.d.ts.map +1 -0
  48. package/dist/test/bundle/cli-bundle.test.js +162 -0
  49. package/dist/test/bundle/cli-bundle.test.js.map +1 -0
  50. package/dist/test/e2e/cli-bundle.e2e.test.d.ts +2 -0
  51. package/dist/test/e2e/cli-bundle.e2e.test.d.ts.map +1 -0
  52. package/dist/test/e2e/cli-bundle.e2e.test.js +172 -0
  53. package/dist/test/e2e/cli-bundle.e2e.test.js.map +1 -0
  54. package/dist/test/unit/bin/build-from-local.test.js +53 -1
  55. package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
  56. package/dist/test/unit/bin/build.test.js +113 -3
  57. package/dist/test/unit/bin/build.test.js.map +1 -1
  58. package/dist/test/unit/bin/slack.test.d.ts +2 -0
  59. package/dist/test/unit/bin/slack.test.d.ts.map +1 -0
  60. package/dist/test/unit/bin/slack.test.js +54 -0
  61. package/dist/test/unit/bin/slack.test.js.map +1 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +13 -3
  64. package/test/bundle/cli-bundle.test.ts +192 -0
  65. package/test/e2e/cli-bundle.e2e.test.ts +237 -0
  66. package/test/unit/bin/build-from-local.test.ts +55 -0
  67. package/test/unit/bin/build.test.ts +135 -3
  68. package/test/unit/bin/slack.test.ts +65 -0
  69. package/.github/scripts/check-package-version-bump.mjs +0 -74
  70. package/.github/workflows-package-version +0 -1
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Generated by `npm run bundle`: collapsed in GitHub diffs and shown as binary by git diff.
2
+ .github/cli/apify-test-tools.mjs linguist-generated=true -diff
@@ -19,8 +19,8 @@ outputs:
19
19
 
20
20
  # Sets common steps and ensure we use cached node_modules
21
21
  # To test a change here, repoint the `uses:` refs in the reusable workflows at your branch, and
22
- # change them back before merging. Merging to master no longer ships it: consumers track the `workflows-v0`
23
- # tag, which only moves once the package version in .github/workflows-package-version is on npm.
22
+ # change them back before merging. Consumers track the `workflows-v0` tag, which moves on every
23
+ # push to master.
24
24
  runs:
25
25
  using: 'composite'
26
26
  steps:
@@ -64,32 +64,16 @@ runs:
64
64
  NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
65
65
  run: npm ci
66
66
 
67
- # Repos can still have older version locally but on cloud we enforce uniformity.
68
- # --no-save swaps the package in node_modules only and leaves the repo's package.json and
69
- # package-lock.json untouched, so node_modules is ahead of the lockfile but the checkout stays clean.
70
- - name: Enforce test tools version required by these workflows
71
- # We don't override beta so we can use it to test branch-specific versions of apify-test-tools
72
- # Needs the npm token too: a repo whose .npmrc routes all traffic through a private
73
- # registry has to authenticate even for public packages.
67
+ # The CLI the workflows call ships with this action as one bundled file (npm run bundle), so
68
+ # nothing is installed for it. The repo's node_modules stays exactly what package-lock.json
69
+ # says, and its tests import the lib from the version they locked.
70
+ # Steps call `apify-test-tools` without npx: npx would pick the repo's own copy in node_modules/.bin first.
71
+ - name: Put apify-test-tools CLI on PATH
74
72
  shell: bash
75
- env:
76
- NPM_TOKEN: ${{ inputs.npm-token }}
77
- NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
78
73
  run: |
79
- locked_version=$(jq -r '.packages["node_modules/apify-test-tools"].version' package-lock.json)
80
- echo "Package-lock version of apify-test-tools: $locked_version"
81
- if [[ "$locked_version" == *"-beta"* ]]; then
82
- echo "Beta version detected, reinstalling $locked_version to ensure cache consistency"
83
- npm install "apify-test-tools@$locked_version" --no-save --audit=false --no-fund;
84
- else
85
- # The workflows name the exact package version they ship with, so a tag is a complete
86
- # statement: these workflows and this library. A frozen major tag then keeps
87
- # installing what it was tested against however far the package moves on. A `>=`
88
- # floor could not do that — being open-ended, it resolves to the newest release
89
- # forever, so freezing the tag would freeze the workflow files but not their
90
- # dependency. The stable release writes this file, so it always names a published
91
- # version; the release that publishes X is the commit that pins X.
92
- pinned_version=$(cat "${{ github.action_path }}/../../workflows-package-version")
93
- echo "Installing apify-test-tools@$pinned_version (pinned by these workflows)"
94
- npm install "apify-test-tools@$pinned_version" --no-save --audit=false --no-fund;
95
- fi
74
+ bundle="$(cd "${{ github.action_path }}/../../cli" && pwd)/apify-test-tools.mjs"
75
+ bin_dir="$RUNNER_TEMP/apify-test-tools-bin"
76
+ mkdir -p "$bin_dir"
77
+ printf '#!/bin/sh\nexec node --no-warnings "%s" "$@"\n' "$bundle" > "$bin_dir/apify-test-tools"
78
+ chmod +x "$bin_dir/apify-test-tools"
79
+ echo "$bin_dir" >> "$GITHUB_PATH"