Skip to content

Commit c090a9f

Browse files
committed
debug
1 parent 8963e6d commit c090a9f

2 files changed

Lines changed: 36 additions & 12 deletions

File tree

packages/beachball/src/__fixtures__/repositoryFactory.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ export class RepositoryFactory {
162162
/** Cloned child repos, tracked so we can clean them up */
163163
private childRepos: Repository[] = [];
164164

165+
public get originRoot(): string {
166+
if (!this.root) {
167+
throw new Error('Factory was already cleaned up');
168+
}
169+
return this.root;
170+
}
171+
165172
/**
166173
* Create the "origin" repo and create+commit fixture files.
167174
* If `fixture` is a string, the corresponding default fixture is used.

packages/beachball/src/__functional__/git/ensureSharedHistory.test.ts

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ describe('ensureSharedHistory', () => {
228228
`);
229229
});
230230

231-
it('deepens history if needed', () => {
231+
it.only('deepens history if needed', () => {
232232
const repo = repositoryFactory.cloneRepository({ depth: 1, branch: testBranch, singleBranch: true });
233233
gitSpy.mockClear();
234234

@@ -242,18 +242,35 @@ describe('ensureSharedHistory', () => {
242242
verbose: true,
243243
});
244244

245-
const allLogs = logs.getMockLines('all');
246-
expect(allLogs).toMatch('Adding branch "master" to fetch config for remote "origin"');
247-
expect(allLogs).toMatch('This is a shallow clone. Deepening to check for changes...');
248-
expect(allLogs).toMatch('Deepening by 2 more commits (attempt 1/3)...');
249-
expect(allLogs).toMatch('Deepening by 2 more commits (attempt 2/3)...');
250-
expect(allLogs).toMatch('Deepening by 2 more commits (attempt 3/3)...');
251-
expect(allLogs).not.toMatch('warning');
252-
expect(logs.mocks.warn).not.toHaveBeenCalled();
253-
expect(logs.mocks.error).not.toHaveBeenCalled();
245+
const allLogs = logs.getMockLines('all', {
246+
replacePaths: { [repo.rootPath]: '<root>', [repositoryFactory.originRoot]: '<origin-dir>' },
247+
});
248+
expect(allLogs).toMatchInlineSnapshot(`
249+
"[log] Adding branch "master" to fetch config for remote "origin"
250+
[log] Fetching branch "master" from remote "origin" (with --depth=2)...
251+
[log] From <origin-dir>
252+
* branch master -> FETCH_HEAD
253+
* [new branch] master -> origin/master
254+
[log] Fetching branch "master" from remote "origin" (with --depth=2) completed successfully
255+
[log] This is a shallow clone. Deepening to check for changes...
256+
[log] Deepening by 2 more commits (attempt 1/3)...
257+
[log] Fetching branch "master" from remote "origin" (with --deepen=2)...
258+
[log] From <origin-dir>
259+
* branch master -> FETCH_HEAD
260+
[log] Fetching branch "master" from remote "origin" (with --deepen=2) completed successfully
261+
[log] Deepening by 2 more commits (attempt 2/3)...
262+
[log] Fetching branch "master" from remote "origin" (with --deepen=2)...
263+
[log] From <origin-dir>
264+
* branch master -> FETCH_HEAD
265+
[log] Fetching branch "master" from remote "origin" (with --deepen=2) completed successfully
266+
[log] Deepening by 2 more commits (attempt 3/3)...
267+
[log] Fetching branch "master" from remote "origin" (with --deepen=2)...
268+
[log] From <origin-dir>
269+
* branch master -> FETCH_HEAD
270+
[log] Fetching branch "master" from remote "origin" (with --deepen=2) completed successfully"
271+
`);
254272

255-
expect(filteredGitCalls().filter(line => !line.startsWith('rev-parse') && !line.startsWith('merge-base')))
256-
.toMatchInlineSnapshot(`
273+
expect(filteredGitCalls()).toMatchInlineSnapshot(`
257274
[
258275
"config --get-all remote.origin.fetch",
259276
"remote set-branches --add origin master",

0 commit comments

Comments
 (0)