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
|
@@ -4,10 +4,7 @@ import { beforeEach, describe, expect, it, test, vi } from 'vitest';
|
|
|
4
4
|
import { isCosmeticOnlyJsonSchemaChange } from '../../../bin/diff-json-schema.js';
|
|
5
5
|
import * as Utils from '../../../bin/utils.js';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
{ sha: 'Commit1', author: '', date: '', message: '' },
|
|
9
|
-
{ sha: 'Commit3', author: '', date: '', message: '' },
|
|
10
|
-
];
|
|
7
|
+
const range = { fromRef: 'Commit0', toRef: 'Commit3' };
|
|
11
8
|
|
|
12
9
|
describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
13
10
|
let gitCommandSpy: MockInstance;
|
|
@@ -23,7 +20,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
23
20
|
test('returns true when nothing changed', async () => {
|
|
24
21
|
const json = JSON.stringify({ type: 'string', title: 'My field' });
|
|
25
22
|
mockGitCalls(json, json);
|
|
26
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
23
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
27
24
|
});
|
|
28
25
|
|
|
29
26
|
test('returns true when only title changes', async () => {
|
|
@@ -31,7 +28,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
31
28
|
JSON.stringify({ type: 'string', title: 'Old title' }),
|
|
32
29
|
JSON.stringify({ type: 'string', title: 'New title' }),
|
|
33
30
|
);
|
|
34
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
31
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
35
32
|
});
|
|
36
33
|
|
|
37
34
|
test('returns true when only description changes', async () => {
|
|
@@ -39,7 +36,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
39
36
|
JSON.stringify({ type: 'string', description: 'Old desc' }),
|
|
40
37
|
JSON.stringify({ type: 'string', description: 'New desc' }),
|
|
41
38
|
);
|
|
42
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
39
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
test('returns true when only example changes', async () => {
|
|
@@ -47,7 +44,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
47
44
|
JSON.stringify({ type: 'string', example: 'foo' }),
|
|
48
45
|
JSON.stringify({ type: 'string', example: 'bar' }),
|
|
49
46
|
);
|
|
50
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
47
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
51
48
|
});
|
|
52
49
|
|
|
53
50
|
test('returns true when only enumTitles changes', async () => {
|
|
@@ -55,7 +52,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
55
52
|
JSON.stringify({ type: 'string', enum: ['a', 'b'], enumTitles: ['Option A', 'Option B'] }),
|
|
56
53
|
JSON.stringify({ type: 'string', enum: ['a', 'b'], enumTitles: ['Choice A', 'Choice B'] }),
|
|
57
54
|
);
|
|
58
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
55
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
59
56
|
});
|
|
60
57
|
|
|
61
58
|
test('returns true when only sectionCaption changes', async () => {
|
|
@@ -63,12 +60,12 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
63
60
|
JSON.stringify({ sectionCaption: 'Old caption' }),
|
|
64
61
|
JSON.stringify({ sectionCaption: 'New caption' }),
|
|
65
62
|
);
|
|
66
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
63
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
67
64
|
});
|
|
68
65
|
|
|
69
66
|
test('returns true when only sectionDescription changes', async () => {
|
|
70
67
|
mockGitCalls(JSON.stringify({ sectionDescription: 'Old' }), JSON.stringify({ sectionDescription: 'New' }));
|
|
71
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
68
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
72
69
|
});
|
|
73
70
|
|
|
74
71
|
test('returns false when a functional field (type) changes', async () => {
|
|
@@ -76,17 +73,17 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
76
73
|
JSON.stringify({ type: 'string', title: 'My field' }),
|
|
77
74
|
JSON.stringify({ type: 'integer', title: 'My field' }),
|
|
78
75
|
);
|
|
79
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
76
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
80
77
|
});
|
|
81
78
|
|
|
82
79
|
test('returns false when a functional field is added', async () => {
|
|
83
80
|
mockGitCalls(JSON.stringify({ title: 'My field' }), JSON.stringify({ title: 'My field', type: 'string' }));
|
|
84
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
81
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
85
82
|
});
|
|
86
83
|
|
|
87
84
|
test('returns false when a functional field is removed', async () => {
|
|
88
85
|
mockGitCalls(JSON.stringify({ type: 'string', title: 'My field' }), JSON.stringify({ title: 'My field' }));
|
|
89
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
86
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
90
87
|
});
|
|
91
88
|
|
|
92
89
|
test('returns true when non-functional fields change at nested level (input schema properties)', async () => {
|
|
@@ -104,7 +101,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
104
101
|
},
|
|
105
102
|
}),
|
|
106
103
|
);
|
|
107
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
104
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
108
105
|
});
|
|
109
106
|
|
|
110
107
|
test('returns false when a functional nested field changes alongside non-functional ones', async () => {
|
|
@@ -118,7 +115,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
118
115
|
properties: { myField: { type: 'integer', title: 'New title' } },
|
|
119
116
|
}),
|
|
120
117
|
);
|
|
121
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
118
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
122
119
|
});
|
|
123
120
|
|
|
124
121
|
test('returns false when a new property is added to input schema', async () => {
|
|
@@ -126,7 +123,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
126
123
|
JSON.stringify({ properties: { fieldA: { type: 'string' } } }),
|
|
127
124
|
JSON.stringify({ properties: { fieldA: { type: 'string' }, fieldB: { type: 'integer' } } }),
|
|
128
125
|
);
|
|
129
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
126
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
130
127
|
});
|
|
131
128
|
|
|
132
129
|
test('returns false when a property is removed from input schema', async () => {
|
|
@@ -134,27 +131,27 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
134
131
|
JSON.stringify({ properties: { fieldA: { type: 'string' }, fieldB: { type: 'integer' } } }),
|
|
135
132
|
JSON.stringify({ properties: { fieldA: { type: 'string' } } }),
|
|
136
133
|
);
|
|
137
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
134
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
138
135
|
});
|
|
139
136
|
|
|
140
137
|
test('returns false when invalid JSON in old content', async () => {
|
|
141
138
|
mockGitCalls('not json', '{}');
|
|
142
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
139
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
143
140
|
});
|
|
144
141
|
|
|
145
142
|
test('returns false when invalid JSON in new content', async () => {
|
|
146
143
|
mockGitCalls('{}', 'not json');
|
|
147
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
144
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
148
145
|
});
|
|
149
146
|
|
|
150
147
|
test('returns false when git cannot read a schema version', async () => {
|
|
151
148
|
gitCommandSpy.mockRejectedValueOnce(new Error('missing schema'));
|
|
152
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
149
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
153
150
|
});
|
|
154
151
|
|
|
155
152
|
test('returns false when array content changes (not under a non-functional key)', async () => {
|
|
156
153
|
mockGitCalls(JSON.stringify({ enum: [1, 2, 3] }), JSON.stringify({ enum: [1, 2, 4] }));
|
|
157
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
154
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
158
155
|
});
|
|
159
156
|
|
|
160
157
|
test('returns true when example array changes (non-functional key)', async () => {
|
|
@@ -162,7 +159,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
162
159
|
JSON.stringify({ type: 'array', example: [1, 2, 3] }),
|
|
163
160
|
JSON.stringify({ type: 'array', example: [4, 5, 6] }),
|
|
164
161
|
);
|
|
165
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
162
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
166
163
|
});
|
|
167
164
|
|
|
168
165
|
test('returns true for a realistic actor.json with only title/description change', async () => {
|
|
@@ -182,7 +179,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
182
179
|
version: '1.0',
|
|
183
180
|
}),
|
|
184
181
|
);
|
|
185
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
182
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
186
183
|
});
|
|
187
184
|
|
|
188
185
|
test('returns true when fields under properties are reordered', async () => {
|
|
@@ -196,7 +193,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
196
193
|
properties: { fieldC: { type: 'boolean' }, fieldA: { type: 'string' }, fieldB: { type: 'integer' } },
|
|
197
194
|
}),
|
|
198
195
|
);
|
|
199
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
196
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(true);
|
|
200
197
|
});
|
|
201
198
|
|
|
202
199
|
test('returns false for a realistic actor.json with version change', async () => {
|
|
@@ -204,14 +201,14 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
204
201
|
JSON.stringify({ actorSpecification: 1, name: 'my-actor', title: 'My Actor', version: '1.0' }),
|
|
205
202
|
JSON.stringify({ actorSpecification: 1, name: 'my-actor', title: 'My Actor', version: '1.1' }),
|
|
206
203
|
);
|
|
207
|
-
await expect(isCosmeticOnlyJsonSchemaChange(
|
|
204
|
+
await expect(isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json')).resolves.toBe(false);
|
|
208
205
|
});
|
|
209
206
|
|
|
210
207
|
it('uses correct git refs: first-commit parent for old, last commit for new', async () => {
|
|
211
208
|
const json = JSON.stringify({});
|
|
212
209
|
mockGitCalls(json, json);
|
|
213
|
-
await isCosmeticOnlyJsonSchemaChange(
|
|
214
|
-
expect(gitCommandSpy).toHaveBeenCalledWith(['show', '
|
|
210
|
+
await isCosmeticOnlyJsonSchemaChange(range, 'actors/foo/actor.json');
|
|
211
|
+
expect(gitCommandSpy).toHaveBeenCalledWith(['show', 'Commit0:actors/foo/actor.json']);
|
|
215
212
|
expect(gitCommandSpy).toHaveBeenCalledWith(['show', 'Commit3:actors/foo/actor.json']);
|
|
216
213
|
});
|
|
217
214
|
});
|