apify-test-tools 0.10.2-beta.2 → 0.10.2-beta.20
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 +1 -0
- package/.github/actionlint.yaml +11 -0
- package/.github/actions/checkout-restore-dependencies/action.yaml +58 -6
- package/.github/cli/apify-test-tools.mjs +135 -142
- package/.github/scripts/mask-config-secrets.sh +17 -0
- package/.github/scripts/run-with-apify-tokens.mjs +63 -103
- package/.github/workflows/_check_code.yaml +5 -21
- package/.github/workflows/_move_major_tag.yaml +2 -2
- package/.github/workflows/public_platform-tests-claude-investigate-and-fix.yaml +89 -8
- package/.github/workflows/public_platform-tests.yaml +68 -30
- package/.github/workflows/public_pr-build-test.yaml +77 -38
- package/.github/workflows/public_push-build-latest.yaml +49 -11
- package/.github/workflows/public_review.yaml +5 -4
- package/.github/workflows/public_stale-issues.yaml +51 -0
- package/.husky/pre-commit +4 -4
- package/.prettierignore +2 -1
- package/CHANGELOG.md +22 -0
- package/CONTRIBUTING.md +117 -17
- package/README.md +221 -595
- package/bin/actor-ids.ts +41 -0
- package/bin/affected-actors.ts +211 -0
- package/bin/build-from-local.ts +19 -1
- package/bin/build.ts +105 -39
- package/bin/diff-changes.ts +69 -36
- package/bin/diff-json-schema.ts +5 -6
- package/bin/git.ts +73 -175
- package/bin/main.ts +142 -189
- package/bin/notify.ts +198 -0
- package/bin/run-tests.ts +167 -0
- package/bin/slack.ts +16 -76
- package/bin/stdin-input.ts +156 -0
- package/bin/test-files-glob.ts +126 -0
- package/bin/test-report.ts +141 -140
- package/bin/types.ts +4 -7
- package/bin/utils/config/load-config.ts +20 -2
- package/bin/utils/config/parser.ts +40 -8
- package/bin/utils/config/structures/grouped.ts +2 -2
- package/bin/utils/config/structures/legacy.ts +1 -1
- package/dist/bin/actor-ids.d.ts +15 -0
- package/dist/bin/actor-ids.d.ts.map +1 -0
- package/dist/bin/actor-ids.js +30 -0
- package/dist/bin/actor-ids.js.map +1 -0
- package/dist/bin/affected-actors.d.ts +55 -0
- package/dist/bin/affected-actors.d.ts.map +1 -0
- package/dist/bin/affected-actors.js +142 -0
- package/dist/bin/affected-actors.js.map +1 -0
- package/dist/bin/build-from-local.d.ts +2 -1
- package/dist/bin/build-from-local.d.ts.map +1 -1
- package/dist/bin/build-from-local.js +6 -2
- package/dist/bin/build-from-local.js.map +1 -1
- package/dist/bin/build.d.ts +18 -5
- package/dist/bin/build.d.ts.map +1 -1
- package/dist/bin/build.js +74 -24
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/diff-changes.d.ts +21 -5
- package/dist/bin/diff-changes.d.ts.map +1 -1
- package/dist/bin/diff-changes.js +41 -28
- 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 +26 -34
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +60 -143
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/main.js +126 -140
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/notify.d.ts +35 -0
- package/dist/bin/notify.d.ts.map +1 -0
- package/dist/bin/notify.js +131 -0
- package/dist/bin/notify.js.map +1 -0
- package/dist/bin/run-tests.d.ts +21 -0
- package/dist/bin/run-tests.d.ts.map +1 -0
- package/dist/bin/run-tests.js +138 -0
- package/dist/bin/run-tests.js.map +1 -0
- package/dist/bin/slack.d.ts +2 -14
- package/dist/bin/slack.d.ts.map +1 -1
- package/dist/bin/slack.js +17 -46
- package/dist/bin/slack.js.map +1 -1
- package/dist/bin/stdin-input.d.ts +79 -0
- package/dist/bin/stdin-input.d.ts.map +1 -0
- package/dist/bin/stdin-input.js +124 -0
- package/dist/bin/stdin-input.js.map +1 -0
- package/dist/bin/test-files-glob.d.ts +18 -0
- package/dist/bin/test-files-glob.d.ts.map +1 -0
- package/dist/bin/test-files-glob.js +108 -0
- package/dist/bin/test-files-glob.js.map +1 -0
- package/dist/bin/test-report.d.ts +69 -8
- package/dist/bin/test-report.d.ts.map +1 -1
- package/dist/bin/test-report.js +76 -67
- package/dist/bin/test-report.js.map +1 -1
- package/dist/bin/types.d.ts +4 -7
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/bin/utils/config/load-config.d.ts +8 -0
- package/dist/bin/utils/config/load-config.d.ts.map +1 -1
- package/dist/bin/utils/config/load-config.js +14 -1
- package/dist/bin/utils/config/load-config.js.map +1 -1
- package/dist/bin/utils/config/parser.d.ts +15 -2
- package/dist/bin/utils/config/parser.d.ts.map +1 -1
- package/dist/bin/utils/config/parser.js +29 -8
- package/dist/bin/utils/config/parser.js.map +1 -1
- package/dist/bin/utils/config/structures/grouped.js +2 -2
- package/dist/bin/utils/config/structures/grouped.js.map +1 -1
- package/dist/bin/utils/config/structures/legacy.js +1 -1
- package/dist/bin/utils/config/structures/legacy.js.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 -5
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +19 -31
- 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.js +76 -56
- package/dist/test/bundle/cli-bundle.test.js.map +1 -1
- package/dist/test/bundle/token-wrapper.test.d.ts +2 -0
- package/dist/test/bundle/token-wrapper.test.d.ts.map +1 -0
- package/dist/test/bundle/token-wrapper.test.js +80 -0
- package/dist/test/bundle/token-wrapper.test.js.map +1 -0
- package/dist/test/e2e/cli-bundle.e2e.test.js +33 -68
- package/dist/test/e2e/cli-bundle.e2e.test.js.map +1 -1
- 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/actor-filtering.test.js +7 -0
- package/dist/test/unit/bin/actor-filtering.test.js.map +1 -1
- package/dist/test/unit/bin/actor-ids.test.d.ts +2 -0
- package/dist/test/unit/bin/actor-ids.test.d.ts.map +1 -0
- package/dist/test/unit/bin/actor-ids.test.js +40 -0
- package/dist/test/unit/bin/actor-ids.test.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 +224 -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 +153 -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 +49 -0
- package/dist/test/unit/bin/build-cli.test.js.map +1 -0
- package/dist/test/unit/bin/build-from-local.test.js +12 -0
- package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
- package/dist/test/unit/bin/build.test.js +116 -6
- 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 +23 -0
- package/dist/test/unit/bin/compiled-cli.js.map +1 -0
- package/dist/test/unit/bin/diff-changes.test.js +168 -114
- 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 +67 -288
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/test/unit/bin/notify.test.d.ts +2 -0
- package/dist/test/unit/bin/notify.test.d.ts.map +1 -0
- package/dist/test/unit/bin/notify.test.js +222 -0
- package/dist/test/unit/bin/notify.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 +92 -0
- package/dist/test/unit/bin/stdin-input.test.js.map +1 -0
- package/dist/test/unit/bin/test-cli.test.d.ts +2 -0
- package/dist/test/unit/bin/test-cli.test.d.ts.map +1 -0
- package/dist/test/unit/bin/test-cli.test.js +146 -0
- package/dist/test/unit/bin/test-cli.test.js.map +1 -0
- package/dist/test/unit/bin/test-files-glob.test.d.ts +2 -0
- package/dist/test/unit/bin/test-files-glob.test.d.ts.map +1 -0
- package/dist/test/unit/bin/test-files-glob.test.js +102 -0
- package/dist/test/unit/bin/test-files-glob.test.js.map +1 -0
- package/dist/test/unit/bin/test-report.test.d.ts +2 -0
- package/dist/test/unit/bin/test-report.test.d.ts.map +1 -0
- package/dist/test/unit/bin/test-report.test.js +100 -0
- package/dist/test/unit/bin/test-report.test.js.map +1 -0
- package/dist/test/unit/bin/utils/config/load-config.test.js +19 -1
- package/dist/test/unit/bin/utils/config/load-config.test.js.map +1 -1
- package/dist/test/unit/bin/utils/config/parser.test.js +36 -4
- package/dist/test/unit/bin/utils/config/parser.test.js.map +1 -1
- package/dist/test/unit/bin/utils/config/structures/grouped.test.js +6 -0
- package/dist/test/unit/bin/utils/config/structures/grouped.test.js.map +1 -1
- package/dist/test/unit/bin/utils/config/structures/legacy.test.js +1 -0
- package/dist/test/unit/bin/utils/config/structures/legacy.test.js.map +1 -1
- 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/dist/workflow-scripts-src/run-with-apify-tokens.d.ts +3 -0
- package/dist/workflow-scripts-src/run-with-apify-tokens.d.ts.map +1 -0
- package/dist/workflow-scripts-src/run-with-apify-tokens.js +100 -0
- package/dist/workflow-scripts-src/run-with-apify-tokens.js.map +1 -0
- package/docs/cli.md +469 -0
- package/docs/lib.md +276 -0
- package/docs/workflows.md +455 -0
- package/eslint.config.mjs +10 -1
- package/lib/extend-expect.ts +48 -258
- package/lib/lib.ts +25 -34
- package/lib/run-checks.ts +101 -0
- package/lib/run-test-result.ts +45 -55
- package/package.json +4 -2
- package/platform-tests-investigate-and-fix/skills/assess-impact/SKILL.md +42 -0
- package/platform-tests-investigate-and-fix/skills/measure-flakiness/SKILL.md +4 -2
- package/test/bundle/cli-bundle.test.ts +97 -67
- package/test/bundle/token-wrapper.test.ts +110 -0
- package/test/e2e/cli-bundle.e2e.test.ts +60 -93
- package/test/e2e/git-build-release.e2e.test.ts +113 -0
- package/test/e2e/helpers.ts +82 -0
- package/test/unit/bin/actor-filtering.test.ts +8 -0
- package/test/unit/bin/actor-ids.test.ts +47 -0
- package/test/unit/bin/affected-actors-cli.test.ts +271 -0
- package/test/unit/bin/affected-actors.test.ts +221 -0
- package/test/unit/bin/build-cli.test.ts +61 -0
- package/test/unit/bin/build-from-local.test.ts +16 -0
- package/test/unit/bin/build.test.ts +149 -5
- package/test/unit/bin/compiled-cli.ts +23 -0
- package/test/unit/bin/diff-changes.test.ts +181 -114
- package/test/unit/bin/diff.test.ts +25 -28
- package/test/unit/bin/git.test.ts +76 -361
- package/test/unit/bin/notify.test.ts +299 -0
- package/test/unit/bin/stdin-input.test.ts +120 -0
- package/test/unit/bin/test-cli.test.ts +175 -0
- package/test/unit/bin/test-files-glob.test.ts +118 -0
- package/test/unit/bin/test-report.test.ts +118 -0
- package/test/unit/bin/utils/config/load-config.test.ts +26 -1
- package/test/unit/bin/utils/config/parser.test.ts +46 -5
- package/test/unit/bin/utils/config/structures/grouped.test.ts +12 -0
- package/test/unit/bin/utils/config/structures/legacy.test.ts +1 -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/tsconfig.json +1 -1
- package/vitest.config.ts +9 -0
- package/workflow-scripts-src/run-with-apify-tokens.ts +112 -0
- package/.github/scripts/check-major-tag-refs.mjs +0 -72
- package/dist/test/unit/bin/logging.test.d.ts +0 -2
- package/dist/test/unit/bin/logging.test.d.ts.map +0 -1
- package/dist/test/unit/bin/logging.test.js +0 -43
- package/dist/test/unit/bin/logging.test.js.map +0 -1
- package/dist/test/unit/bin/slack.test.d.ts +0 -2
- package/dist/test/unit/bin/slack.test.d.ts.map +0 -1
- package/dist/test/unit/bin/slack.test.js +0 -54
- package/dist/test/unit/bin/slack.test.js.map +0 -1
- package/test/unit/bin/logging.test.ts +0 -52
- package/test/unit/bin/slack.test.ts +0 -65
|
@@ -39,91 +39,99 @@ const amazonActor = actorConfig('junglee/amazon-crawler', 'actors/junglee_Amazon
|
|
|
39
39
|
'code',
|
|
40
40
|
'shared',
|
|
41
41
|
]);
|
|
42
|
-
const
|
|
42
|
+
const range = { fromRef: 'Commit0', toRef: 'Commit1' };
|
|
43
|
+
// What a PR (functional changes only) or a release (isLatest, all changes) builds, in config order
|
|
44
|
+
const changedActorsFor = async ({ isLatest = false, ...options }) => {
|
|
45
|
+
const { functional, cosmetic } = await getChangedActors(options);
|
|
46
|
+
const changed = isLatest ? [...functional, ...cosmetic] : functional;
|
|
47
|
+
return options.actorConfigs.filter((config) => changed.includes(config));
|
|
48
|
+
};
|
|
49
|
+
// The Actors whose platform tests run because of a test change
|
|
50
|
+
const testChangedActorsFor = async (options) => (await getChangedActors(options)).test;
|
|
43
51
|
describe('getChangedActors', () => {
|
|
44
52
|
beforeEach(() => {
|
|
45
53
|
vi.restoreAllMocks();
|
|
46
54
|
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(false);
|
|
47
55
|
});
|
|
48
56
|
it('returns empty array when no files changed', async () => {
|
|
49
|
-
expect(await
|
|
57
|
+
expect(await changedActorsFor({ filepathsChanged: [], actorConfigs, range })).toEqual([]);
|
|
50
58
|
});
|
|
51
59
|
it('returns empty array when only ignored top-level files changed', async () => {
|
|
52
|
-
const result = await
|
|
60
|
+
const result = await changedActorsFor({
|
|
53
61
|
filepathsChanged: ['.gitignore', 'README.md', '.husky/pre-commit', '.vscode/settings.json'],
|
|
54
62
|
actorConfigs,
|
|
55
|
-
|
|
63
|
+
range,
|
|
56
64
|
});
|
|
57
65
|
expect(result).toEqual([]);
|
|
58
66
|
});
|
|
59
67
|
it('does not ignore source files whose names contain an ignored file name', async () => {
|
|
60
|
-
const result = await
|
|
68
|
+
const result = await changedActorsFor({
|
|
61
69
|
filepathsChanged: ['actors/foo_bar/src/.gitignore-helper.ts'],
|
|
62
70
|
actorConfigs,
|
|
63
|
-
|
|
71
|
+
range,
|
|
64
72
|
});
|
|
65
73
|
expect(result).toEqual([miniActor]);
|
|
66
74
|
});
|
|
67
75
|
it('returns the actor when a functional file in its folder changes', async () => {
|
|
68
|
-
const result = await
|
|
76
|
+
const result = await changedActorsFor({
|
|
69
77
|
filepathsChanged: ['actors/foo_bar/src/main.ts'],
|
|
70
78
|
actorConfigs,
|
|
71
|
-
|
|
79
|
+
range,
|
|
72
80
|
});
|
|
73
81
|
expect(result).toEqual([miniActor]);
|
|
74
82
|
});
|
|
75
83
|
it('returns actor when isLatest and README in actor folder changed (cosmetic)', async () => {
|
|
76
|
-
const result = await
|
|
84
|
+
const result = await changedActorsFor({
|
|
77
85
|
filepathsChanged: ['actors/foo_bar/README.md'],
|
|
78
86
|
actorConfigs,
|
|
79
|
-
|
|
87
|
+
range,
|
|
80
88
|
isLatest: true,
|
|
81
89
|
});
|
|
82
90
|
expect(result).toEqual([miniActor]);
|
|
83
91
|
});
|
|
84
92
|
it('does not return actor when not isLatest and only README changed (cosmetic)', async () => {
|
|
85
|
-
const result = await
|
|
93
|
+
const result = await changedActorsFor({
|
|
86
94
|
filepathsChanged: ['actors/foo_bar/README.md'],
|
|
87
95
|
actorConfigs,
|
|
88
|
-
|
|
96
|
+
range,
|
|
89
97
|
isLatest: false,
|
|
90
98
|
});
|
|
91
99
|
expect(result).toEqual([]);
|
|
92
100
|
});
|
|
93
101
|
it('returns actor when isLatest and JSON file has only cosmetic changes', async () => {
|
|
94
102
|
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
|
|
95
|
-
const result = await
|
|
103
|
+
const result = await changedActorsFor({
|
|
96
104
|
filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
|
|
97
105
|
actorConfigs,
|
|
98
|
-
|
|
106
|
+
range,
|
|
99
107
|
isLatest: true,
|
|
100
108
|
});
|
|
101
109
|
expect(result).toEqual([miniActor]);
|
|
102
110
|
});
|
|
103
111
|
it('does not return actor when not isLatest and JSON file has only cosmetic changes', async () => {
|
|
104
112
|
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
|
|
105
|
-
const result = await
|
|
113
|
+
const result = await changedActorsFor({
|
|
106
114
|
filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
|
|
107
115
|
actorConfigs,
|
|
108
|
-
|
|
116
|
+
range,
|
|
109
117
|
isLatest: false,
|
|
110
118
|
});
|
|
111
119
|
expect(result).toEqual([]);
|
|
112
120
|
});
|
|
113
121
|
it('returns actor when JSON file has functional changes', async () => {
|
|
114
|
-
const result = await
|
|
122
|
+
const result = await changedActorsFor({
|
|
115
123
|
filepathsChanged: ['actors/foo_bar/.actor/actor.json'],
|
|
116
124
|
actorConfigs,
|
|
117
|
-
|
|
125
|
+
range,
|
|
118
126
|
});
|
|
119
127
|
expect(result).toEqual([miniActor]);
|
|
120
128
|
});
|
|
121
129
|
it('JSON file in actor folder but outside .actor/ is functional, not checked for cosmetic', async () => {
|
|
122
130
|
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
|
|
123
|
-
const result = await
|
|
131
|
+
const result = await changedActorsFor({
|
|
124
132
|
filepathsChanged: ['actors/foo_bar/package.json'],
|
|
125
133
|
actorConfigs,
|
|
126
|
-
|
|
134
|
+
range,
|
|
127
135
|
isLatest: false,
|
|
128
136
|
});
|
|
129
137
|
expect(result).toEqual([miniActor]);
|
|
@@ -131,48 +139,48 @@ describe('getChangedActors', () => {
|
|
|
131
139
|
});
|
|
132
140
|
it('JSON file under .actor/ inside actor folder is checked for cosmetic changes', async () => {
|
|
133
141
|
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(true);
|
|
134
|
-
const result = await
|
|
142
|
+
const result = await changedActorsFor({
|
|
135
143
|
filepathsChanged: ['actors/foo_bar/.actor/input_schema.json'],
|
|
136
144
|
actorConfigs,
|
|
137
|
-
|
|
145
|
+
range,
|
|
138
146
|
isLatest: false,
|
|
139
147
|
});
|
|
140
148
|
expect(result).toEqual([]);
|
|
141
|
-
expect(DiffJsonSchema.isCosmeticOnlyJsonSchemaChange).toHaveBeenCalledWith(
|
|
149
|
+
expect(DiffJsonSchema.isCosmeticOnlyJsonSchemaChange).toHaveBeenCalledWith(range, 'actors/foo_bar/.actor/input_schema.json');
|
|
142
150
|
});
|
|
143
151
|
it('does not trigger narrow-context actor when shared file changes', async () => {
|
|
144
|
-
const result = await
|
|
152
|
+
const result = await changedActorsFor({
|
|
145
153
|
filepathsChanged: ['shared/utils.ts'],
|
|
146
154
|
actorConfigs,
|
|
147
|
-
|
|
155
|
+
range,
|
|
148
156
|
});
|
|
149
157
|
expect(result).toContainEqual(miniActor);
|
|
150
158
|
expect(result).not.toContainEqual(standaloneActor);
|
|
151
159
|
});
|
|
152
160
|
it('root-level changelog outside any actor folder is cosmetic for every actor when isLatest', async () => {
|
|
153
|
-
const result = await
|
|
161
|
+
const result = await changedActorsFor({
|
|
154
162
|
filepathsChanged: ['CHANGELOG.md'],
|
|
155
163
|
actorConfigs,
|
|
156
|
-
|
|
164
|
+
range,
|
|
157
165
|
isLatest: true,
|
|
158
166
|
});
|
|
159
167
|
expect(result).toEqual(expect.arrayContaining([miniActor, standaloneActor]));
|
|
160
168
|
expect(result).toHaveLength(2);
|
|
161
169
|
});
|
|
162
170
|
it('root-level changelog is not cosmetic-triggered when not isLatest', async () => {
|
|
163
|
-
const result = await
|
|
171
|
+
const result = await changedActorsFor({
|
|
164
172
|
filepathsChanged: ['CHANGELOG.md'],
|
|
165
173
|
actorConfigs,
|
|
166
|
-
|
|
174
|
+
range,
|
|
167
175
|
isLatest: false,
|
|
168
176
|
});
|
|
169
177
|
expect(result).toEqual([]);
|
|
170
178
|
});
|
|
171
179
|
it('treats any changelog filename as cosmetic regardless of configured paths', async () => {
|
|
172
|
-
const result = await
|
|
180
|
+
const result = await changedActorsFor({
|
|
173
181
|
filepathsChanged: ['docs/CHANGELOG.md'],
|
|
174
182
|
actorConfigs: [miniActor, standaloneActor],
|
|
175
|
-
|
|
183
|
+
range,
|
|
176
184
|
isLatest: true,
|
|
177
185
|
});
|
|
178
186
|
expect(result).toEqual([miniActor, standaloneActor]);
|
|
@@ -182,63 +190,63 @@ describe('getChangedActors', () => {
|
|
|
182
190
|
...standaloneActor,
|
|
183
191
|
actorJson: { ...standaloneActor.actorJson, readme: new RelativeFile('docs/guide.md') },
|
|
184
192
|
};
|
|
185
|
-
const result = await
|
|
193
|
+
const result = await changedActorsFor({
|
|
186
194
|
filepathsChanged: ['docs/guide.md'],
|
|
187
195
|
actorConfigs: [configuredActor],
|
|
188
|
-
|
|
196
|
+
range,
|
|
189
197
|
isLatest: true,
|
|
190
198
|
});
|
|
191
199
|
expect(result).toEqual([]);
|
|
192
200
|
});
|
|
193
201
|
it('triggers narrow-context actor when its own folder changes', async () => {
|
|
194
|
-
const result = await
|
|
202
|
+
const result = await changedActorsFor({
|
|
195
203
|
filepathsChanged: ['standalone-actors/standalone/src/main.ts'],
|
|
196
204
|
actorConfigs,
|
|
197
|
-
|
|
205
|
+
range,
|
|
198
206
|
});
|
|
199
207
|
expect(result).toContainEqual(standaloneActor);
|
|
200
208
|
});
|
|
201
209
|
it('deduplicates actors when multiple files in same actor folder change', async () => {
|
|
202
|
-
const result = await
|
|
210
|
+
const result = await changedActorsFor({
|
|
203
211
|
filepathsChanged: ['actors/foo_bar/src/main.ts', 'actors/foo_bar/package.json'],
|
|
204
212
|
actorConfigs,
|
|
205
|
-
|
|
213
|
+
range,
|
|
206
214
|
});
|
|
207
215
|
expect(result).toHaveLength(1);
|
|
208
216
|
expect(result).toContainEqual(miniActor);
|
|
209
217
|
});
|
|
210
218
|
it('handles mixed changes: returns both broad and narrow-context actors', async () => {
|
|
211
|
-
const result = await
|
|
219
|
+
const result = await changedActorsFor({
|
|
212
220
|
filepathsChanged: ['actors/foo_bar/src/main.ts', 'standalone-actors/standalone/Dockerfile'],
|
|
213
221
|
actorConfigs,
|
|
214
|
-
|
|
222
|
+
range,
|
|
215
223
|
});
|
|
216
224
|
expect(result).toContainEqual(miniActor);
|
|
217
225
|
expect(result).toContainEqual(standaloneActor);
|
|
218
226
|
});
|
|
219
227
|
it('matches folder where folder name differs from actor name', async () => {
|
|
220
228
|
const ownerlessActor = actorConfig('myteam/shopify-scraper', 'actors/shopify', 'APIFY_TOKEN_MYTEAM', '', ['']);
|
|
221
|
-
const result = await
|
|
229
|
+
const result = await changedActorsFor({
|
|
222
230
|
filepathsChanged: ['actors/shopify/src/main.ts'],
|
|
223
231
|
actorConfigs: [ownerlessActor],
|
|
224
|
-
|
|
232
|
+
range,
|
|
225
233
|
});
|
|
226
234
|
expect(result).toEqual([ownerlessActor]);
|
|
227
235
|
});
|
|
228
236
|
it('in single-actor repo, .actor/ changes trigger builds', async () => {
|
|
229
237
|
const rootActor = actorConfig('myteam/my-actor', '', 'BUILDER_APIFY_TOKEN', '', ['']);
|
|
230
|
-
const result = await
|
|
238
|
+
const result = await changedActorsFor({
|
|
231
239
|
filepathsChanged: ['.actor/actor.json'],
|
|
232
240
|
actorConfigs: [rootActor],
|
|
233
|
-
|
|
241
|
+
range,
|
|
234
242
|
});
|
|
235
243
|
expect(result).toEqual([rootActor]);
|
|
236
244
|
});
|
|
237
245
|
it('in multi-actor repo, .actor/ changes only trigger broad-context actors', async () => {
|
|
238
|
-
const result = await
|
|
246
|
+
const result = await changedActorsFor({
|
|
239
247
|
filepathsChanged: ['.actor/actor.json'],
|
|
240
248
|
actorConfigs,
|
|
241
|
-
|
|
249
|
+
range,
|
|
242
250
|
});
|
|
243
251
|
expect(result).toEqual([miniActor]);
|
|
244
252
|
});
|
|
@@ -246,38 +254,38 @@ describe('getChangedActors', () => {
|
|
|
246
254
|
const narrowActor = actorConfig('foo/bar', 'actors/foo_bar', 'APIFY_TOKEN_FOO', 'actors/foo_bar', [
|
|
247
255
|
'actors/foo_bar',
|
|
248
256
|
]);
|
|
249
|
-
const result = await
|
|
257
|
+
const result = await changedActorsFor({
|
|
250
258
|
filepathsChanged: ['Actors/FOO_BAR/Main.ts'],
|
|
251
259
|
actorConfigs: [narrowActor],
|
|
252
|
-
|
|
260
|
+
range,
|
|
253
261
|
});
|
|
254
262
|
expect(result).toEqual([]);
|
|
255
263
|
});
|
|
256
264
|
it('triggers actor with contextPaths override when file matches an override path', async () => {
|
|
257
265
|
const overrideActor = actorConfig('team/override-actor', 'actors/override', 'APIFY_TOKEN_TEAM', 'actors/override', ['actors/override', 'packages']);
|
|
258
|
-
const result = await
|
|
266
|
+
const result = await changedActorsFor({
|
|
259
267
|
filepathsChanged: ['packages/shared/utils.ts'],
|
|
260
268
|
actorConfigs: [overrideActor],
|
|
261
|
-
|
|
269
|
+
range,
|
|
262
270
|
});
|
|
263
271
|
expect(result).toEqual([overrideActor]);
|
|
264
272
|
});
|
|
265
273
|
it('does not trigger actor with contextPaths override when file is outside all override paths', async () => {
|
|
266
274
|
const overrideActor = actorConfig('team/override-actor', 'actors/override', 'APIFY_TOKEN_TEAM', 'actors/override', ['actors/override', 'packages']);
|
|
267
|
-
const result = await
|
|
275
|
+
const result = await changedActorsFor({
|
|
268
276
|
filepathsChanged: ['other-dir/file.ts'],
|
|
269
277
|
actorConfigs: [overrideActor],
|
|
270
|
-
|
|
278
|
+
range,
|
|
271
279
|
});
|
|
272
280
|
expect(result).toEqual([]);
|
|
273
281
|
});
|
|
274
282
|
it('broad-context actor skips files in sibling actor folders', async () => {
|
|
275
283
|
const actorA = actorConfig('team/actor-a', 'actors/a', 'APIFY_TOKEN_TEAM', '', ['']);
|
|
276
284
|
const actorB = actorConfig('team/actor-b', 'actors/b', 'APIFY_TOKEN_TEAM', '', ['']);
|
|
277
|
-
const result = await
|
|
285
|
+
const result = await changedActorsFor({
|
|
278
286
|
filepathsChanged: ['actors/b/src/main.ts'],
|
|
279
287
|
actorConfigs: [actorA, actorB],
|
|
280
|
-
|
|
288
|
+
range,
|
|
281
289
|
});
|
|
282
290
|
expect(result).toEqual([actorB]);
|
|
283
291
|
});
|
|
@@ -286,10 +294,10 @@ describe('getChangedActors', () => {
|
|
|
286
294
|
const childActor = actorConfig('team/child', 'actors/child', 'APIFY_TOKEN_TEAM', 'actors/child', [
|
|
287
295
|
'actors/child',
|
|
288
296
|
]);
|
|
289
|
-
const result = await
|
|
297
|
+
const result = await changedActorsFor({
|
|
290
298
|
filepathsChanged: ['actors/child/src/main.ts'],
|
|
291
299
|
actorConfigs: [rootActor, childActor],
|
|
292
|
-
|
|
300
|
+
range,
|
|
293
301
|
});
|
|
294
302
|
expect(result).not.toContainEqual(rootActor);
|
|
295
303
|
expect(result).toContainEqual(childActor);
|
|
@@ -299,74 +307,96 @@ describe('getChangedActors', () => {
|
|
|
299
307
|
const childActor = actorConfig('team/child', 'actors/child', 'APIFY_TOKEN_TEAM', 'actors/child', [
|
|
300
308
|
'actors/child',
|
|
301
309
|
]);
|
|
302
|
-
const result = await
|
|
310
|
+
const result = await changedActorsFor({
|
|
303
311
|
filepathsChanged: ['lib/shared-utils.ts'],
|
|
304
312
|
actorConfigs: [rootActor, childActor],
|
|
305
|
-
|
|
313
|
+
range,
|
|
306
314
|
});
|
|
307
315
|
expect(result).toContainEqual(rootActor);
|
|
308
316
|
expect(result).not.toContainEqual(childActor);
|
|
309
317
|
});
|
|
310
318
|
it('file matched by .dockerignore is treated as ignored', async () => {
|
|
311
319
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue((filePath) => filePath === 'actors/foo_bar/node_modules/foo.js');
|
|
312
|
-
const result = await
|
|
320
|
+
const result = await changedActorsFor({
|
|
313
321
|
filepathsChanged: ['actors/foo_bar/node_modules/foo.js'],
|
|
314
322
|
actorConfigs: [miniActor],
|
|
315
|
-
|
|
323
|
+
range,
|
|
316
324
|
});
|
|
317
325
|
expect(result).toEqual([]);
|
|
318
326
|
});
|
|
319
327
|
it('file not matched by .dockerignore is classified normally', async () => {
|
|
320
328
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue((filePath) => filePath.includes('node_modules'));
|
|
321
|
-
const result = await
|
|
329
|
+
const result = await changedActorsFor({
|
|
322
330
|
filepathsChanged: ['actors/foo_bar/src/main.ts'],
|
|
323
331
|
actorConfigs: [miniActor],
|
|
324
|
-
|
|
332
|
+
range,
|
|
325
333
|
});
|
|
326
334
|
expect(result).toEqual([miniActor]);
|
|
327
335
|
});
|
|
328
|
-
it('test file listed in .dockerignore
|
|
336
|
+
it('test file listed in .dockerignore is a test change when it matches the platform tests glob', async () => {
|
|
329
337
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue((filePath) => filePath.startsWith('test/'));
|
|
330
|
-
const
|
|
338
|
+
const options = {
|
|
331
339
|
filepathsChanged: ['test/platform/daily/foo.test.ts'],
|
|
332
340
|
actorConfigs: [miniActor],
|
|
333
|
-
|
|
334
|
-
|
|
341
|
+
range,
|
|
342
|
+
platformTestsGlob: 'test/platform/**',
|
|
343
|
+
};
|
|
344
|
+
expect(await testChangedActorsFor(options)).toEqual([miniActor]);
|
|
345
|
+
// A test change needs no build of its own, neither for a PR nor for a release
|
|
346
|
+
expect(await changedActorsFor({ ...options, isLatest: true })).toEqual([]);
|
|
347
|
+
});
|
|
348
|
+
it('a test change that is not listed in .dockerignore is still only a test change', async () => {
|
|
349
|
+
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue(() => false);
|
|
350
|
+
const options = {
|
|
351
|
+
filepathsChanged: ['test/platform/utils.ts'],
|
|
352
|
+
actorConfigs: [miniActor],
|
|
353
|
+
range,
|
|
354
|
+
platformTestsGlob: 'test/platform/**',
|
|
355
|
+
};
|
|
356
|
+
expect(await testChangedActorsFor(options)).toEqual([miniActor]);
|
|
357
|
+
expect(await changedActorsFor({ ...options, isLatest: true })).toEqual([]);
|
|
358
|
+
});
|
|
359
|
+
it('lists an Actor with both source and test changes as functional and as test changed', async () => {
|
|
360
|
+
const result = await getChangedActors({
|
|
361
|
+
filepathsChanged: ['test/platform/daily/foo.test.ts', 'actors/foo_bar/src/main.ts'],
|
|
362
|
+
actorConfigs: [miniActor],
|
|
363
|
+
range,
|
|
364
|
+
platformTestsGlob: 'test/platform/**',
|
|
335
365
|
});
|
|
336
|
-
expect(result).
|
|
366
|
+
expect(result).toStrictEqual({ functional: [miniActor], cosmetic: [], test: [miniActor] });
|
|
337
367
|
});
|
|
338
|
-
it('test file listed in .dockerignore stays ignored without a
|
|
368
|
+
it('test file listed in .dockerignore stays ignored without a platform tests glob', async () => {
|
|
339
369
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue((filePath) => filePath.startsWith('test/'));
|
|
340
370
|
const result = await getChangedActors({
|
|
341
371
|
filepathsChanged: ['test/platform/daily/foo.test.ts'],
|
|
342
372
|
actorConfigs: [miniActor],
|
|
343
|
-
|
|
373
|
+
range,
|
|
344
374
|
});
|
|
345
|
-
expect(result).
|
|
375
|
+
expect(result).toStrictEqual({ functional: [], cosmetic: [], test: [] });
|
|
346
376
|
});
|
|
347
|
-
it('
|
|
377
|
+
it('platform tests glob matches case-insensitively and does not bypass .dockerignore for other files', async () => {
|
|
348
378
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue(() => true);
|
|
349
|
-
const result = await
|
|
379
|
+
const result = await testChangedActorsFor({
|
|
350
380
|
filepathsChanged: ['Test/Platform/Foo.test.ts'],
|
|
351
381
|
actorConfigs: [miniActor],
|
|
352
|
-
|
|
353
|
-
|
|
382
|
+
range,
|
|
383
|
+
platformTestsGlob: 'test/platform/**',
|
|
354
384
|
});
|
|
355
385
|
expect(result).toEqual([miniActor]);
|
|
356
|
-
expect(await
|
|
386
|
+
expect(await changedActorsFor({
|
|
357
387
|
filepathsChanged: ['actors/foo_bar/node_modules/foo.js'],
|
|
358
388
|
actorConfigs: [miniActor],
|
|
359
|
-
|
|
360
|
-
|
|
389
|
+
range,
|
|
390
|
+
platformTestsGlob: 'test/platform/**',
|
|
361
391
|
})).toEqual([]);
|
|
362
392
|
});
|
|
363
393
|
it('test file outside an actor context still does not trigger it', async () => {
|
|
364
394
|
vi.spyOn(Dockerignore, 'loadDockerIgnore').mockReturnValue(() => true);
|
|
365
|
-
const result = await
|
|
395
|
+
const result = await changedActorsFor({
|
|
366
396
|
filepathsChanged: ['test/platform/daily/foo.test.ts'],
|
|
367
397
|
actorConfigs: [standaloneActor],
|
|
368
|
-
|
|
369
|
-
|
|
398
|
+
range,
|
|
399
|
+
platformTestsGlob: 'test/platform/**',
|
|
370
400
|
});
|
|
371
401
|
expect(result).toEqual([]);
|
|
372
402
|
});
|
|
@@ -376,77 +406,77 @@ describe('getChangedActors', () => {
|
|
|
376
406
|
...standaloneActor,
|
|
377
407
|
contextPaths: [...standaloneActor.contextPaths, new RelativeDir('test')],
|
|
378
408
|
};
|
|
379
|
-
const result = await
|
|
409
|
+
const result = await testChangedActorsFor({
|
|
380
410
|
filepathsChanged: ['test/platform/standalone.test.ts'],
|
|
381
411
|
actorConfigs: [actorWithTests],
|
|
382
|
-
|
|
383
|
-
|
|
412
|
+
range,
|
|
413
|
+
platformTestsGlob: 'test/platform/**',
|
|
384
414
|
});
|
|
385
415
|
expect(result).toEqual([actorWithTests]);
|
|
386
416
|
});
|
|
387
417
|
it('JSON file in context but outside actor folder is functional (not checked for cosmetic)', async () => {
|
|
388
|
-
const result = await
|
|
418
|
+
const result = await changedActorsFor({
|
|
389
419
|
filepathsChanged: ['lib/config.json'],
|
|
390
420
|
actorConfigs: [miniActor],
|
|
391
|
-
|
|
421
|
+
range,
|
|
392
422
|
});
|
|
393
423
|
expect(result).toEqual([miniActor]);
|
|
394
424
|
});
|
|
395
425
|
it('README outside actor folder but inside context is ignored (not cosmetic)', async () => {
|
|
396
|
-
const result = await
|
|
426
|
+
const result = await changedActorsFor({
|
|
397
427
|
filepathsChanged: ['docs/README.md'],
|
|
398
428
|
actorConfigs: [miniActor],
|
|
399
|
-
|
|
429
|
+
range,
|
|
400
430
|
isLatest: true,
|
|
401
431
|
});
|
|
402
432
|
expect(result).toEqual([]);
|
|
403
433
|
});
|
|
404
434
|
it('README inside actor folder is cosmetic', async () => {
|
|
405
|
-
const result = await
|
|
435
|
+
const result = await changedActorsFor({
|
|
406
436
|
filepathsChanged: ['actors/foo_bar/README.md'],
|
|
407
437
|
actorConfigs: [miniActor],
|
|
408
|
-
|
|
438
|
+
range,
|
|
409
439
|
isLatest: true,
|
|
410
440
|
});
|
|
411
441
|
expect(result).toEqual([miniActor]);
|
|
412
442
|
});
|
|
413
443
|
it('ignores a standalone actor top-level dev file relative to its context', async () => {
|
|
414
|
-
const result = await
|
|
444
|
+
const result = await changedActorsFor({
|
|
415
445
|
filepathsChanged: ['standalone-actors/standalone/.eslintrc'],
|
|
416
446
|
actorConfigs,
|
|
417
|
-
|
|
447
|
+
range,
|
|
418
448
|
});
|
|
419
449
|
expect(result).toEqual([]);
|
|
420
450
|
});
|
|
421
|
-
it('does not special-case code/ and shared/ prefixes
|
|
422
|
-
const result = await
|
|
451
|
+
it('does not special-case code/ and shared/ prefixes — they must be declared via overrideActorContext', async () => {
|
|
452
|
+
const result = await changedActorsFor({
|
|
423
453
|
filepathsChanged: ['code/some/code.ts'],
|
|
424
454
|
actorConfigs: [miniActor],
|
|
425
|
-
|
|
455
|
+
range,
|
|
426
456
|
});
|
|
427
457
|
expect(result).toEqual([miniActor]);
|
|
428
458
|
});
|
|
429
459
|
it('ignores code/.eslintrc when "code" is declared via overrideActorContext', async () => {
|
|
430
|
-
const result = await
|
|
460
|
+
const result = await changedActorsFor({
|
|
431
461
|
filepathsChanged: ['code/.eslintrc'],
|
|
432
462
|
actorConfigs: [amazonActor],
|
|
433
|
-
|
|
463
|
+
range,
|
|
434
464
|
});
|
|
435
465
|
expect(result).toEqual([]);
|
|
436
466
|
});
|
|
437
467
|
it('shared/Dockerfile declared via overrideActorContext is functional', async () => {
|
|
438
|
-
const result = await
|
|
468
|
+
const result = await changedActorsFor({
|
|
439
469
|
filepathsChanged: ['shared/Dockerfile'],
|
|
440
470
|
actorConfigs: [amazonActor],
|
|
441
|
-
|
|
471
|
+
range,
|
|
442
472
|
});
|
|
443
473
|
expect(result).toEqual([amazonActor]);
|
|
444
474
|
});
|
|
445
475
|
it('code/README.md declared via overrideActorContext is ignored (outside actor folder)', async () => {
|
|
446
|
-
const result = await
|
|
476
|
+
const result = await changedActorsFor({
|
|
447
477
|
filepathsChanged: ['code/README.md'],
|
|
448
478
|
actorConfigs: [amazonActor],
|
|
449
|
-
|
|
479
|
+
range,
|
|
450
480
|
isLatest: true,
|
|
451
481
|
});
|
|
452
482
|
expect(result).toEqual([]);
|
|
@@ -462,10 +492,11 @@ describe('getChangedActors logging', () => {
|
|
|
462
492
|
await getChangedActors({
|
|
463
493
|
filepathsChanged: ['actors/foo_bar/src/main.ts'],
|
|
464
494
|
actorConfigs: [miniActor],
|
|
465
|
-
|
|
495
|
+
range,
|
|
466
496
|
});
|
|
467
497
|
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Changes specific to actor foo/bar: actors/foo_bar/src/main.ts');
|
|
468
|
-
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors
|
|
498
|
+
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors with functional changes: foo/bar');
|
|
499
|
+
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors with only cosmetic changes: none');
|
|
469
500
|
});
|
|
470
501
|
it('logs a single "shared" group when two actors are triggered by the exact same file', async () => {
|
|
471
502
|
const actorA = actorConfig('team/actor-a', 'actors/a', 'APIFY_TOKEN_TEAM', '', ['', 'shared']);
|
|
@@ -473,11 +504,11 @@ describe('getChangedActors logging', () => {
|
|
|
473
504
|
await getChangedActors({
|
|
474
505
|
filepathsChanged: ['shared/shared.ts'],
|
|
475
506
|
actorConfigs: [actorA, actorB],
|
|
476
|
-
|
|
507
|
+
range,
|
|
477
508
|
});
|
|
478
509
|
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Shared changes for actors team/actor-a, team/actor-b: shared/shared.ts');
|
|
479
510
|
expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to actor'));
|
|
480
|
-
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors
|
|
511
|
+
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors with functional changes: team/actor-a, team/actor-b');
|
|
481
512
|
});
|
|
482
513
|
it('logs shared and specific groups in descending-size order for partial overlap across actors', async () => {
|
|
483
514
|
const actorA = actorConfig('team/actor-a', 'actors/a', 'APIFY_TOKEN_TEAM', '', ['']);
|
|
@@ -485,14 +516,16 @@ describe('getChangedActors logging', () => {
|
|
|
485
516
|
await getChangedActors({
|
|
486
517
|
filepathsChanged: ['shared.ts', 'actors/a/a-only.ts', 'actors/b/b-only.ts'],
|
|
487
518
|
actorConfigs: [actorA, actorB],
|
|
488
|
-
|
|
519
|
+
range,
|
|
489
520
|
});
|
|
490
521
|
const errorCalls = vi.mocked(logger.info).mock.calls.map((call) => call[0]);
|
|
491
522
|
expect(errorCalls).toEqual([
|
|
492
523
|
'[DIFF]: Shared changes for actors team/actor-a, team/actor-b: shared.ts',
|
|
493
524
|
'[DIFF]: Changes specific to actor team/actor-a: actors/a/a-only.ts',
|
|
494
525
|
'[DIFF]: Changes specific to actor team/actor-b: actors/b/b-only.ts',
|
|
495
|
-
'[DIFF]: Actors
|
|
526
|
+
'[DIFF]: Actors with functional changes: team/actor-a, team/actor-b',
|
|
527
|
+
'[DIFF]: Actors with only cosmetic changes: none',
|
|
528
|
+
'[DIFF]: Actors with platform test changes: none',
|
|
496
529
|
]);
|
|
497
530
|
});
|
|
498
531
|
const outsideContextWarning = (testFile) => `[DIFF]: Test file ${testFile} is outside every Actor's context, so changing only it builds and tests nothing. ` +
|
|
@@ -501,17 +534,17 @@ describe('getChangedActors logging', () => {
|
|
|
501
534
|
await getChangedActors({
|
|
502
535
|
filepathsChanged: ['test/platform/standalone.test.ts'],
|
|
503
536
|
actorConfigs: [standaloneActor],
|
|
504
|
-
|
|
505
|
-
|
|
537
|
+
range,
|
|
538
|
+
platformTestsGlob: 'test/platform/**',
|
|
506
539
|
});
|
|
507
540
|
expect(logger.warn).toHaveBeenCalledWith(outsideContextWarning('test/platform/standalone.test.ts'));
|
|
508
541
|
});
|
|
509
542
|
it('still warns when the same push also rebuilds an Actor', async () => {
|
|
510
|
-
const result = await
|
|
543
|
+
const result = await changedActorsFor({
|
|
511
544
|
filepathsChanged: ['test/platform/standalone.test.ts', 'standalone-actors/standalone/src/main.ts'],
|
|
512
545
|
actorConfigs: [standaloneActor],
|
|
513
|
-
|
|
514
|
-
|
|
546
|
+
range,
|
|
547
|
+
platformTestsGlob: 'test/platform/**',
|
|
515
548
|
});
|
|
516
549
|
expect(result).toEqual([standaloneActor]);
|
|
517
550
|
expect(logger.warn).toHaveBeenCalledWith(outsideContextWarning('test/platform/standalone.test.ts'));
|
|
@@ -520,8 +553,8 @@ describe('getChangedActors logging', () => {
|
|
|
520
553
|
await getChangedActors({
|
|
521
554
|
filepathsChanged: ['test/platform/foo.test.ts', 'test/platform/README.md', 'test/platform/CHANGELOG.md'],
|
|
522
555
|
actorConfigs: [miniActor],
|
|
523
|
-
|
|
524
|
-
|
|
556
|
+
range,
|
|
557
|
+
platformTestsGlob: 'test/platform/**',
|
|
525
558
|
});
|
|
526
559
|
expect(logger.warn).not.toHaveBeenCalled();
|
|
527
560
|
});
|
|
@@ -529,11 +562,32 @@ describe('getChangedActors logging', () => {
|
|
|
529
562
|
await getChangedActors({
|
|
530
563
|
filepathsChanged: ['.gitignore', '.prettierrc'],
|
|
531
564
|
actorConfigs,
|
|
532
|
-
|
|
565
|
+
range,
|
|
533
566
|
});
|
|
534
567
|
expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Shared changes'));
|
|
535
568
|
expect(logger.info).not.toHaveBeenCalledWith(expect.stringContaining('Changes specific to'));
|
|
536
|
-
expect(logger.info).toHaveBeenCalledWith('[DIFF]:
|
|
569
|
+
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors with functional changes: none');
|
|
570
|
+
expect(logger.info).toHaveBeenCalledWith('[DIFF]: Actors with only cosmetic changes: none');
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
describe('getChangedActors split by impact', () => {
|
|
574
|
+
beforeEach(() => {
|
|
575
|
+
vi.spyOn(DiffJsonSchema, 'isCosmeticOnlyJsonSchemaChange').mockResolvedValue(false);
|
|
576
|
+
});
|
|
577
|
+
it('lists an Actor as functional when it has any functional change, and as cosmetic only otherwise', async () => {
|
|
578
|
+
const result = await getChangedActors({
|
|
579
|
+
filepathsChanged: [
|
|
580
|
+
'actors/foo_bar/README.md',
|
|
581
|
+
'standalone-actors/standalone/README.md',
|
|
582
|
+
'actors/foo_bar/src/main.ts',
|
|
583
|
+
],
|
|
584
|
+
actorConfigs,
|
|
585
|
+
range,
|
|
586
|
+
});
|
|
587
|
+
expect(result).toStrictEqual({ functional: [miniActor], cosmetic: [standaloneActor], test: [] });
|
|
588
|
+
});
|
|
589
|
+
it('returns empty lists when nothing relevant changed', async () => {
|
|
590
|
+
expect(await getChangedActors({ filepathsChanged: ['.vscode/settings.json'], actorConfigs, range })).toStrictEqual({ functional: [], cosmetic: [], test: [] });
|
|
537
591
|
});
|
|
538
592
|
});
|
|
539
593
|
//# sourceMappingURL=diff-changes.test.js.map
|