apify-test-tools 0.10.1-beta.2 → 0.10.1-beta.3
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/.github/actions/checkout-restore-dependencies/action.yaml +4 -3
- package/.github/workflows/public_platform-tests.yaml +0 -1
- package/.github/workflows-package-version +1 -1
- package/CONTRIBUTING.md +4 -3
- package/README.md +2 -2
- package/bin/diff-json-schema.ts +3 -3
- package/bin/git.ts +14 -19
- package/bin/main.ts +0 -8
- package/bin/types.ts +0 -1
- package/bin/utils.ts +1 -9
- package/dist/bin/diff-json-schema.js +3 -3
- package/dist/bin/diff-json-schema.js.map +1 -1
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +14 -14
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/main.js +0 -7
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/types.d.ts +0 -1
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/bin/utils.d.ts +1 -4
- package/dist/bin/utils.d.ts.map +1 -1
- package/dist/bin/utils.js +1 -8
- package/dist/bin/utils.js.map +1 -1
- package/dist/test/unit/bin/build-from-local.test.js +1 -1
- package/dist/test/unit/bin/build-from-local.test.js.map +1 -1
- package/dist/test/unit/bin/diff.test.js +1 -1
- package/dist/test/unit/bin/diff.test.js.map +1 -1
- package/dist/test/unit/bin/git.test.js +11 -13
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/unit/bin/build-from-local.test.ts +1 -1
- package/test/unit/bin/diff.test.ts +1 -1
- package/test/unit/bin/git.test.ts +11 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify-test-tools",
|
|
3
|
-
"version": "0.10.1-beta.
|
|
3
|
+
"version": "0.10.1-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TBD",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"start": "npm run dist/bin/main.js",
|
|
50
|
-
"start:dev": "tsx bin/main.ts
|
|
50
|
+
"start:dev": "cd local-clone && tsx ../bin/main.ts",
|
|
51
51
|
"build": "tsc && chmod +x ./dist/bin/main.js",
|
|
52
52
|
"lint": "eslint",
|
|
53
53
|
"lint:fix": "eslint --fix",
|
|
@@ -150,7 +150,7 @@ describe('build-from-local helpers', () => {
|
|
|
150
150
|
|
|
151
151
|
const originalCwd = process.cwd();
|
|
152
152
|
// We simulate the working directory being the repo root, since collectSourceFiles uses relative paths to the repo root.
|
|
153
|
-
|
|
153
|
+
process.chdir(repoRoot);
|
|
154
154
|
try {
|
|
155
155
|
const cwd = process.cwd();
|
|
156
156
|
const actorDir = path.join(cwd, 'actors', 'owner_actor');
|
|
@@ -13,7 +13,7 @@ describe('isCosmeticOnlyJsonSchemaChange', () => {
|
|
|
13
13
|
let gitCommandSpy: MockInstance;
|
|
14
14
|
|
|
15
15
|
beforeEach(() => {
|
|
16
|
-
gitCommandSpy = vi.spyOn(Utils, '
|
|
16
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const mockGitCalls = (oldJson: string, newJson: string) => {
|
|
@@ -30,9 +30,7 @@ describe('getCommits', () => {
|
|
|
30
30
|
let gitCommandSpy: MockInstance;
|
|
31
31
|
|
|
32
32
|
beforeEach(() => {
|
|
33
|
-
gitCommandSpy = vi
|
|
34
|
-
.spyOn(Utils, 'spawnCommandInGhWorkspace')
|
|
35
|
-
.mockReturnValue(`${commit3}\n${commit2}\n${commit1}`);
|
|
33
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand').mockReturnValue(`${commit3}\n${commit2}\n${commit1}`);
|
|
36
34
|
});
|
|
37
35
|
|
|
38
36
|
it('should return commits between source and target branches', () => {
|
|
@@ -102,7 +100,7 @@ describe('getChangedFiles', () => {
|
|
|
102
100
|
let gitCommandSpy: MockInstance;
|
|
103
101
|
|
|
104
102
|
beforeEach(() => {
|
|
105
|
-
gitCommandSpy = vi.spyOn(Utils, '
|
|
103
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand').mockReturnValue('file1.txt\nfolder/file2.txt');
|
|
106
104
|
});
|
|
107
105
|
|
|
108
106
|
it('should return changed files between commits', () => {
|
|
@@ -171,7 +169,7 @@ describe('hasMergeFromTarget', () => {
|
|
|
171
169
|
let gitCommandSpy: MockInstance;
|
|
172
170
|
|
|
173
171
|
beforeEach(() => {
|
|
174
|
-
gitCommandSpy = vi.spyOn(Utils, '
|
|
172
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand');
|
|
175
173
|
});
|
|
176
174
|
|
|
177
175
|
it('should return false when there are no merge commits on the branch', () => {
|
|
@@ -220,7 +218,7 @@ describe('getBranchOnlyChangedFiles', () => {
|
|
|
220
218
|
let gitCommandSpy: MockInstance;
|
|
221
219
|
|
|
222
220
|
beforeEach(() => {
|
|
223
|
-
gitCommandSpy = vi.spyOn(Utils, '
|
|
221
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand');
|
|
224
222
|
});
|
|
225
223
|
|
|
226
224
|
it('should return files touched by non-merge commits', () => {
|
|
@@ -273,12 +271,12 @@ describe('parseBaseCommit', () => {
|
|
|
273
271
|
|
|
274
272
|
describe('getCurrentBranch', () => {
|
|
275
273
|
it('should return the checked-out branch', () => {
|
|
276
|
-
vi.spyOn(Utils, '
|
|
274
|
+
vi.spyOn(Utils, 'spawnCommand').mockReturnValue('master');
|
|
277
275
|
expect(getCurrentBranch()).toBe('master');
|
|
278
276
|
});
|
|
279
277
|
|
|
280
278
|
it('should throw on a detached HEAD', () => {
|
|
281
|
-
vi.spyOn(Utils, '
|
|
279
|
+
vi.spyOn(Utils, 'spawnCommand').mockReturnValue('HEAD');
|
|
282
280
|
expect(() => getCurrentBranch()).toThrow('HEAD is detached');
|
|
283
281
|
});
|
|
284
282
|
});
|
|
@@ -313,7 +311,7 @@ describe('resolveReleaseBaseCommit', () => {
|
|
|
313
311
|
const baseSha = 'b'.repeat(40);
|
|
314
312
|
|
|
315
313
|
it('should return the base commit when it is an ancestor of HEAD', () => {
|
|
316
|
-
vi.spyOn(Utils, '
|
|
314
|
+
vi.spyOn(Utils, 'spawnCommand').mockImplementation((cmd: string) => {
|
|
317
315
|
if (cmd.startsWith('git rev-parse --verify')) return baseSha;
|
|
318
316
|
if (cmd.startsWith('git merge-base')) return baseSha;
|
|
319
317
|
return '';
|
|
@@ -322,18 +320,18 @@ describe('resolveReleaseBaseCommit', () => {
|
|
|
322
320
|
});
|
|
323
321
|
|
|
324
322
|
it('should throw on the all-zeros SHA of a newly created branch', () => {
|
|
325
|
-
const spy = vi.spyOn(Utils, '
|
|
323
|
+
const spy = vi.spyOn(Utils, 'spawnCommand');
|
|
326
324
|
expect(() => resolveReleaseBaseCommit('0'.repeat(40))).toThrow('the branch was just created');
|
|
327
325
|
expect(spy).not.toHaveBeenCalled();
|
|
328
326
|
});
|
|
329
327
|
|
|
330
328
|
it('should throw when the base commit is missing from the local history', () => {
|
|
331
|
-
vi.spyOn(Utils, '
|
|
329
|
+
vi.spyOn(Utils, 'spawnCommand').mockReturnValue('');
|
|
332
330
|
expect(() => resolveReleaseBaseCommit(baseSha)).toThrow('is not in the local git history');
|
|
333
331
|
});
|
|
334
332
|
|
|
335
333
|
it('should throw when the base commit is not an ancestor of HEAD (force push)', () => {
|
|
336
|
-
vi.spyOn(Utils, '
|
|
334
|
+
vi.spyOn(Utils, 'spawnCommand').mockImplementation((cmd: string) => {
|
|
337
335
|
if (cmd.startsWith('git rev-parse --verify')) return baseSha;
|
|
338
336
|
if (cmd.startsWith('git merge-base')) return 'c'.repeat(40);
|
|
339
337
|
return '';
|
|
@@ -355,7 +353,7 @@ describe('getReleaseChanges', () => {
|
|
|
355
353
|
let gitCommandSpy: MockInstance;
|
|
356
354
|
|
|
357
355
|
beforeEach(() => {
|
|
358
|
-
gitCommandSpy = vi.spyOn(Utils, '
|
|
356
|
+
gitCommandSpy = vi.spyOn(Utils, 'spawnCommand').mockImplementation((cmd: string) => {
|
|
359
357
|
if (cmd === 'git rev-parse HEAD') return headSha;
|
|
360
358
|
if (cmd.startsWith('git log')) return `${mergeCommit}\n${mergedBranchCommit}`;
|
|
361
359
|
if (cmd.startsWith('git diff --name-only')) return 'actors/foo/src/main.ts\nCHANGELOG.md';
|