apify-test-tools 0.8.1-beta.0 → 0.8.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/_update_release_metadata.yaml +1 -1
- package/.github/workflows/manual_release_stable.yaml +1 -1
- package/.github/workflows/on_master.yaml +1 -1
- package/README.md +210 -74
- package/bin/git.ts +17 -0
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +13 -0
- package/dist/bin/git.js.map +1 -1
- package/dist/test/unit/bin/git.test.js +15 -0
- package/dist/test/unit/bin/git.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/test/unit/bin/git.test.ts +18 -0
package/package.json
CHANGED
|
@@ -63,6 +63,18 @@ describe('getCommits', () => {
|
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
it('should ignore the base commit and return all commits when it is the branch HEAD (rerun or force push)', () => {
|
|
67
|
+
// Act
|
|
68
|
+
const commits = getCommits({ sourceBranch, targetBranch, baseCommit: sha3 });
|
|
69
|
+
|
|
70
|
+
// Assert
|
|
71
|
+
expect(commits).toStrictEqual([
|
|
72
|
+
{ sha: sha1, author: 'Author1', date: 'Date1', message: 'First Change On Feature' },
|
|
73
|
+
{ sha: sha2, author: 'Author1', date: 'Date2', message: 'Second Change On Feature' },
|
|
74
|
+
{ sha: sha3, author: 'Author1', date: 'Date3', message: 'Third Change On Feature' },
|
|
75
|
+
]);
|
|
76
|
+
});
|
|
77
|
+
|
|
66
78
|
it('should return all commits if base commit is not found', () => {
|
|
67
79
|
// Act
|
|
68
80
|
const commits = getCommits({ sourceBranch, targetBranch, baseCommit: 'a'.repeat(40) });
|
|
@@ -107,6 +119,12 @@ describe('getChangedFiles', () => {
|
|
|
107
119
|
expect(gitCommandSpy).toHaveBeenCalledWith(`git diff --name-only ${firstSha}~..${lastSha}`);
|
|
108
120
|
});
|
|
109
121
|
|
|
122
|
+
it('should throw without running git when the commit list is empty', () => {
|
|
123
|
+
// Act & Assert
|
|
124
|
+
expect(() => getChangedFiles([])).toThrow('Cannot get changed files: the commit list is empty');
|
|
125
|
+
expect(gitCommandSpy).not.toHaveBeenCalled();
|
|
126
|
+
});
|
|
127
|
+
|
|
110
128
|
it('should handle only one commit', () => {
|
|
111
129
|
// Arrange
|
|
112
130
|
const onlySha = '1'.repeat(40);
|