apify-test-tools 0.10.2-beta.1 → 0.10.2-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/.github/actionlint.yaml +11 -0
- package/.github/actions/checkout-restore-dependencies/action.yaml +64 -28
- package/.github/cli/apify-test-tools.mjs +360 -0
- package/.github/scripts/mask-config-secrets.sh +17 -0
- package/.github/scripts/run-with-apify-tokens.mjs +37 -12
- package/.github/workflows/_check_code.yaml +25 -16
- package/.github/workflows/_move_major_tag.yaml +5 -83
- package/.github/workflows/_tests.yaml +34 -0
- package/.github/workflows/_update_release_metadata.yaml +0 -12
- package/.github/workflows/manual_move_major_tag.yaml +3 -3
- package/.github/workflows/manual_release_stable.yaml +3 -13
- package/.github/workflows/on_master.yaml +9 -5
- package/.github/workflows/on_pull_request.yaml +3 -48
- package/.github/workflows/public_platform-tests-claude-investigate-and-fix.yaml +16 -3
- package/.github/workflows/public_platform-tests.yaml +27 -3
- package/.github/workflows/public_pr-build-test.yaml +67 -29
- package/.github/workflows/public_push-build-latest.yaml +44 -10
- package/.github/workflows/public_review.yaml +5 -4
- package/.husky/pre-commit +5 -0
- package/.prettierignore +3 -0
- package/CHANGELOG.md +17 -0
- package/CONTRIBUTING.md +112 -24
- package/README.md +218 -600
- package/bin/affected-actors.ts +198 -0
- package/bin/build-from-local.ts +65 -13
- package/bin/build.ts +123 -41
- package/bin/diff-changes.ts +32 -23
- package/bin/diff-json-schema.ts +5 -6
- package/bin/git.ts +69 -99
- package/bin/main.ts +96 -135
- package/bin/slack.ts +43 -10
- package/bin/stdin-input.ts +65 -0
- package/bin/test-report.ts +6 -9
- package/bin/types.ts +15 -0
- package/dist/bin/affected-actors.d.ts +46 -0
- package/dist/bin/affected-actors.d.ts.map +1 -0
- package/dist/bin/affected-actors.js +135 -0
- package/dist/bin/affected-actors.js.map +1 -0
- package/dist/bin/build-from-local.d.ts +12 -3
- package/dist/bin/build-from-local.d.ts.map +1 -1
- package/dist/bin/build-from-local.js +34 -12
- package/dist/bin/build-from-local.js.map +1 -1
- package/dist/bin/build.d.ts +30 -7
- package/dist/bin/build.d.ts.map +1 -1
- package/dist/bin/build.js +85 -26
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/diff-changes.d.ts +11 -4
- package/dist/bin/diff-changes.d.ts.map +1 -1
- package/dist/bin/diff-changes.js +19 -19
- package/dist/bin/diff-changes.js.map +1 -1
- package/dist/bin/diff-json-schema.d.ts +2 -2
- package/dist/bin/diff-json-schema.d.ts.map +1 -1
- package/dist/bin/diff-json-schema.js +1 -4
- package/dist/bin/diff-json-schema.js.map +1 -1
- package/dist/bin/git.d.ts +23 -21
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +60 -83
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/main.js +82 -105
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/slack.d.ts +14 -4
- package/dist/bin/slack.d.ts.map +1 -1
- package/dist/bin/slack.js +39 -6
- package/dist/bin/slack.js.map +1 -1
- package/dist/bin/stdin-input.d.ts +17 -0
- package/dist/bin/stdin-input.d.ts.map +1 -0
- package/dist/bin/stdin-input.js +54 -0
- package/dist/bin/stdin-input.js.map +1 -0
- package/dist/bin/test-report.d.ts.map +1 -1
- package/dist/bin/test-report.js +6 -8
- package/dist/bin/test-report.js.map +1 -1
- package/dist/bin/types.d.ts +13 -0
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/lib/extend-expect.d.ts.map +1 -1
- package/dist/lib/extend-expect.js +37 -218
- package/dist/lib/extend-expect.js.map +1 -1
- package/dist/lib/lib.d.ts +1 -2
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +15 -22
- package/dist/lib/lib.js.map +1 -1
- package/dist/lib/run-checks.d.ts +14 -0
- package/dist/lib/run-checks.d.ts.map +1 -0
- package/dist/lib/run-checks.js +82 -0
- package/dist/lib/run-checks.js.map +1 -0
- package/dist/lib/run-test-result.d.ts +3 -6
- package/dist/lib/run-test-result.d.ts.map +1 -1
- package/dist/lib/run-test-result.js +41 -54
- package/dist/lib/run-test-result.js.map +1 -1
- package/dist/test/bundle/cli-bundle.test.d.ts +2 -0
- package/dist/test/bundle/cli-bundle.test.d.ts.map +1 -0
- package/dist/test/bundle/cli-bundle.test.js +190 -0
- package/dist/test/bundle/cli-bundle.test.js.map +1 -0
- package/dist/test/e2e/cli-bundle.e2e.test.d.ts +2 -0
- package/dist/test/e2e/cli-bundle.e2e.test.d.ts.map +1 -0
- package/dist/test/e2e/cli-bundle.e2e.test.js +138 -0
- package/dist/test/e2e/cli-bundle.e2e.test.js.map +1 -0
- package/dist/test/e2e/git-build-release.e2e.test.d.ts +2 -0
- package/dist/test/e2e/git-build-release.e2e.test.d.ts.map +1 -0
- package/dist/test/e2e/git-build-release.e2e.test.js +87 -0
- package/dist/test/e2e/git-build-release.e2e.test.js.map +1 -0
- package/dist/test/e2e/helpers.d.ts +37 -0
- package/dist/test/e2e/helpers.d.ts.map +1 -0
- package/dist/test/e2e/helpers.js +57 -0
- package/dist/test/e2e/helpers.js.map +1 -0
- package/dist/test/unit/bin/affected-actors-cli.test.d.ts +2 -0
- package/dist/test/unit/bin/affected-actors-cli.test.d.ts.map +1 -0
- package/dist/test/unit/bin/affected-actors-cli.test.js +167 -0
- package/dist/test/unit/bin/affected-actors-cli.test.js.map +1 -0
- package/dist/test/unit/bin/affected-actors.test.d.ts +2 -0
- package/dist/test/unit/bin/affected-actors.test.d.ts.map +1 -0
- package/dist/test/unit/bin/affected-actors.test.js +141 -0
- package/dist/test/unit/bin/affected-actors.test.js.map +1 -0
- package/dist/test/unit/bin/build-cli.test.d.ts +2 -0
- package/dist/test/unit/bin/build-cli.test.d.ts.map +1 -0
- package/dist/test/unit/bin/build-cli.test.js +44 -0
- package/dist/test/unit/bin/build-cli.test.js.map +1 -0
- package/dist/test/unit/bin/build-from-local.test.js +65 -1
- package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
- package/dist/test/unit/bin/build.test.js +223 -3
- package/dist/test/unit/bin/build.test.js.map +1 -1
- package/dist/test/unit/bin/compiled-cli.d.ts +6 -0
- package/dist/test/unit/bin/compiled-cli.d.ts.map +1 -0
- package/dist/test/unit/bin/compiled-cli.js +16 -0
- package/dist/test/unit/bin/compiled-cli.js.map +1 -0
- package/dist/test/unit/bin/diff-changes.test.js +130 -101
- package/dist/test/unit/bin/diff-changes.test.js.map +1 -1
- package/dist/test/unit/bin/diff.test.js +25 -28
- package/dist/test/unit/bin/diff.test.js.map +1 -1
- package/dist/test/unit/bin/git.test.js +69 -152
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/test/unit/bin/slack.test.d.ts +2 -0
- package/dist/test/unit/bin/slack.test.d.ts.map +1 -0
- package/dist/test/unit/bin/slack.test.js +71 -0
- package/dist/test/unit/bin/slack.test.js.map +1 -0
- package/dist/test/unit/bin/stdin-input.test.d.ts +2 -0
- package/dist/test/unit/bin/stdin-input.test.d.ts.map +1 -0
- package/dist/test/unit/bin/stdin-input.test.js +50 -0
- package/dist/test/unit/bin/stdin-input.test.js.map +1 -0
- package/dist/test/unit/github-scripts/mask-config-secrets.test.d.ts +2 -0
- package/dist/test/unit/github-scripts/mask-config-secrets.test.d.ts.map +1 -0
- package/dist/test/unit/github-scripts/mask-config-secrets.test.js +50 -0
- package/dist/test/unit/github-scripts/mask-config-secrets.test.js.map +1 -0
- package/dist/test/unit/github-scripts/run-with-apify-tokens.test.d.ts +2 -0
- package/dist/test/unit/github-scripts/run-with-apify-tokens.test.d.ts.map +1 -0
- package/dist/test/unit/github-scripts/run-with-apify-tokens.test.js +102 -0
- package/dist/test/unit/github-scripts/run-with-apify-tokens.test.js.map +1 -0
- package/dist/test/unit/run-checks.test.d.ts +2 -0
- package/dist/test/unit/run-checks.test.d.ts.map +1 -0
- package/dist/test/unit/run-checks.test.js +62 -0
- package/dist/test/unit/run-checks.test.js.map +1 -0
- package/dist/test/unit/run-test-result.test.d.ts +2 -0
- package/dist/test/unit/run-test-result.test.d.ts.map +1 -0
- package/dist/test/unit/run-test-result.test.js +34 -0
- package/dist/test/unit/run-test-result.test.js.map +1 -0
- package/dist/test/unit/should-built-and-test.test.js +41 -38
- package/dist/test/unit/should-built-and-test.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/cli.md +373 -0
- package/docs/lib.md +271 -0
- package/docs/workflows.md +370 -0
- package/lib/extend-expect.ts +48 -258
- package/lib/lib.ts +24 -28
- package/lib/run-checks.ts +101 -0
- package/lib/run-test-result.ts +45 -55
- package/package.json +13 -3
- package/test/bundle/cli-bundle.test.ts +235 -0
- package/test/e2e/cli-bundle.e2e.test.ts +207 -0
- package/test/e2e/git-build-release.e2e.test.ts +113 -0
- package/test/e2e/helpers.ts +82 -0
- package/test/unit/bin/affected-actors-cli.test.ts +201 -0
- package/test/unit/bin/affected-actors.test.ts +182 -0
- package/test/unit/bin/build-cli.test.ts +55 -0
- package/test/unit/bin/build-from-local.test.ts +71 -0
- package/test/unit/bin/build.test.ts +279 -3
- package/test/unit/bin/compiled-cli.ts +17 -0
- package/test/unit/bin/diff-changes.test.ts +139 -101
- package/test/unit/bin/diff.test.ts +25 -28
- package/test/unit/bin/git.test.ts +85 -176
- package/test/unit/bin/slack.test.ts +84 -0
- package/test/unit/bin/stdin-input.test.ts +61 -0
- package/test/unit/github-scripts/mask-config-secrets.test.ts +61 -0
- package/test/unit/github-scripts/run-with-apify-tokens.test.ts +115 -0
- package/test/unit/run-checks.test.ts +76 -0
- package/test/unit/run-test-result.test.ts +44 -0
- package/test/unit/should-built-and-test.test.ts +46 -39
- package/.github/scripts/check-major-tag-refs.mjs +0 -72
- package/.github/scripts/check-package-version-bump.mjs +0 -74
- package/.github/workflows-package-version +0 -1
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Fails if any reference to this repo's own reusable workflows or composite actions points at a
|
|
3
|
-
// different tag than MAJOR_TAG in _move_major_tag.yaml.
|
|
4
|
-
//
|
|
5
|
-
// `uses:` cannot take an expression ("You cannot use contexts or expressions in this keyword"), so
|
|
6
|
-
// the tag consumers pin is repeated literally in every self-reference, in the commented examples,
|
|
7
|
-
// and in the README snippets people copy. Bumping the major means editing all of them by hand.
|
|
8
|
-
//
|
|
9
|
-
// Missing one is quiet in the worst case: right after a bump both the old and new tags exist, so a
|
|
10
|
-
// workflow called at the new tag happily pulls the composite action from the old one and runs a
|
|
11
|
-
// stale version of it. Nothing fails, the behaviour is just wrong.
|
|
12
|
-
|
|
13
|
-
import fs from 'node:fs';
|
|
14
|
-
import path from 'node:path';
|
|
15
|
-
|
|
16
|
-
const ROOT = path.resolve(import.meta.dirname, '../..');
|
|
17
|
-
const TAG_SOURCE = '.github/workflows/_move_major_tag.yaml';
|
|
18
|
-
const REVIEW_WORKFLOW = '.github/workflows/public_review.yaml';
|
|
19
|
-
|
|
20
|
-
// Every place a ref into this repo can appear: live `uses:`, commented examples, README snippets.
|
|
21
|
-
const SEARCH_PATHS = ['.github', 'README.md', 'CONTRIBUTING.md'];
|
|
22
|
-
|
|
23
|
-
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
|
|
24
|
-
|
|
25
|
-
const expected = read(TAG_SOURCE).match(/^\s*MAJOR_TAG:\s*(\S+)\s*$/m)?.[1];
|
|
26
|
-
if (!expected) {
|
|
27
|
-
console.error(`Could not find MAJOR_TAG in ${TAG_SOURCE}.`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const walk = (rel) => {
|
|
32
|
-
const abs = path.join(ROOT, rel);
|
|
33
|
-
if (!fs.statSync(abs).isDirectory()) return [rel];
|
|
34
|
-
return fs.readdirSync(abs).flatMap((entry) => walk(path.join(rel, entry)));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const problems = [];
|
|
38
|
-
|
|
39
|
-
// Self-references, e.g. `uses: apify/apify-test-tools/.github/workflows/public_pr-build-test.yaml@workflows-v0`.
|
|
40
|
-
// The ref charset stops at a backtick or quote so a ref quoted in prose isn't captured with its
|
|
41
|
-
// punctuation; git refnames cannot end in a dot, so a sentence-final one is trimmed.
|
|
42
|
-
const SELF_REF = /apify\/apify-test-tools\/\.github\/\S*?@([A-Za-z0-9._/-]+)/g;
|
|
43
|
-
for (const file of SEARCH_PATHS.flatMap(walk)) {
|
|
44
|
-
read(file)
|
|
45
|
-
.split('\n')
|
|
46
|
-
.forEach((line, i) => {
|
|
47
|
-
for (const [match, rawRef] of line.matchAll(SELF_REF)) {
|
|
48
|
-
const ref = rawRef.replace(/\.+$/, '');
|
|
49
|
-
if (ref !== expected) {
|
|
50
|
-
problems.push(`${file}:${i + 1}: ${match.trim()} — expected @${expected}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// review.yaml fetches its prompt from this repo by ref rather than by `uses:`, so it drifts the
|
|
57
|
-
// same way: released workflows would read instructions from some other commit.
|
|
58
|
-
const promptRef = read(REVIEW_WORKFLOW).match(/prompt-ref:\s*\n\s*default:\s*(\S+)/)?.[1];
|
|
59
|
-
if (!promptRef) {
|
|
60
|
-
problems.push(`${REVIEW_WORKFLOW}: could not read the prompt-ref default.`);
|
|
61
|
-
} else if (promptRef !== expected) {
|
|
62
|
-
problems.push(`${REVIEW_WORKFLOW}: prompt-ref default is ${promptRef} — expected ${expected}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (problems.length > 0) {
|
|
66
|
-
console.error(`MAJOR_TAG is ${expected}, but these disagree:\n`);
|
|
67
|
-
for (const problem of problems) console.error(` ${problem}`);
|
|
68
|
-
console.error(`\nUpdate them, or change MAJOR_TAG in ${TAG_SOURCE}.`);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.log(`All references to this repo point at @${expected}.`);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Reads changed file paths on stdin (one per line) and fails if a PR changes both a consumer-facing
|
|
3
|
-
// workflow and the package code it calls, without repinning in workflows-package-version.
|
|
4
|
-
//
|
|
5
|
-
// The case this catches: a workflow starts using a CLI feature from the same PR. On merge the tag
|
|
6
|
-
// moves, the workflow goes live, and it calls something that is not on npm yet — breaking every
|
|
7
|
-
// consumer's CI at once. Pinning the unreleased version instead holds the tag until it publishes.
|
|
8
|
-
//
|
|
9
|
-
// It deliberately only looks at one PR. A workflow could also start depending on package code that
|
|
10
|
-
// landed in an *earlier*, still-unreleased PR, which this will not see — that needs someone to ship
|
|
11
|
-
// a breaking CLI change and then sit on it unreleased, and catching it means flagging every workflow
|
|
12
|
-
// edit made while any package change is unreleased, which is far more noise than the case is worth.
|
|
13
|
-
|
|
14
|
-
const PUBLIC_WORKFLOW = /^\.github\/workflows\/public_.*\.ya?ml$/;
|
|
15
|
-
// The composite action is consumer-facing too, and it is what installs the package.
|
|
16
|
-
const PUBLIC_ACTION = /^\.github\/actions\//;
|
|
17
|
-
// What `npx apify-test-tools ...` runs, and the library the platform tests import.
|
|
18
|
-
const PACKAGE_CODE = /^(bin\/|lib\/|index\.ts$)/;
|
|
19
|
-
const PIN_FILE = '.github/workflows-package-version';
|
|
20
|
-
const OVERRIDE_LABEL = 'no-version-bump-needed';
|
|
21
|
-
|
|
22
|
-
const changed = await new Promise((resolve) => {
|
|
23
|
-
let buffer = '';
|
|
24
|
-
process.stdin.setEncoding('utf8');
|
|
25
|
-
process.stdin.on('data', (chunk) => (buffer += chunk));
|
|
26
|
-
process.stdin.on('end', () =>
|
|
27
|
-
resolve(
|
|
28
|
-
buffer
|
|
29
|
-
.split('\n')
|
|
30
|
-
.map((l) => l.trim())
|
|
31
|
-
.filter(Boolean),
|
|
32
|
-
),
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const publicSurface = changed.filter((f) => PUBLIC_WORKFLOW.test(f) || PUBLIC_ACTION.test(f));
|
|
37
|
-
const packageCode = changed.filter((f) => PACKAGE_CODE.test(f));
|
|
38
|
-
const versionRepinned = changed.includes(PIN_FILE);
|
|
39
|
-
|
|
40
|
-
if (publicSurface.length === 0 || packageCode.length === 0) {
|
|
41
|
-
console.log('No consumer-facing workflow and package change in the same PR; nothing to check.');
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (versionRepinned) {
|
|
46
|
-
console.log(`Both sides changed and ${PIN_FILE} was repinned. The tag will hold until that version ships.`);
|
|
47
|
-
process.exit(0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
(process.env.PR_LABELS ?? '')
|
|
52
|
-
.split(',')
|
|
53
|
-
.map((l) => l.trim())
|
|
54
|
-
.includes(OVERRIDE_LABEL)
|
|
55
|
-
) {
|
|
56
|
-
console.log(`Both sides changed without a version bump, allowed by the "${OVERRIDE_LABEL}" label.`);
|
|
57
|
-
process.exit(0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
console.error(`This PR changes consumer-facing workflows and the package code they call:
|
|
61
|
-
|
|
62
|
-
workflows: ${publicSurface.join(', ')}
|
|
63
|
-
package: ${packageCode.join(', ')}
|
|
64
|
-
|
|
65
|
-
On merge the tag moves and those workflows go live immediately, against whatever is on npm today.
|
|
66
|
-
If they rely on anything from the package change in this PR, that is not published yet and every
|
|
67
|
-
consumer's CI breaks.
|
|
68
|
-
|
|
69
|
-
If they do rely on it, set ${PIN_FILE} to the version that will contain it. The tag is then held
|
|
70
|
-
until you cut that release, and moves on its own once it is published.
|
|
71
|
-
|
|
72
|
-
If they do not rely on it — the two changes just happen to be in one PR — add the
|
|
73
|
-
"${OVERRIDE_LABEL}" label.`);
|
|
74
|
-
process.exit(1);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.11.0
|