-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sequential-prepare): do not wait forever when a child package has…
… no change
- Loading branch information
1 parent
6288293
commit 713046a
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -907,6 +907,67 @@ describe("multiSemanticRelease()", () => { | |
}); | ||
}); | ||
|
||
test("Changes in parent packages with sequentialPrepare", async () => { | ||
// Create Git repo. | ||
const cwd = gitInit(); | ||
// Initial commit. | ||
copyDirectory(`test/fixtures/yarnWorkspaces2Packages/`, cwd); | ||
const sha1 = gitCommitAll(cwd, "feat: Initial release"); | ||
gitTag(cwd, "[email protected]"); | ||
gitTag(cwd, "[email protected]"); | ||
// Second commit. | ||
writeFileSync(`${cwd}/packages/c/aaa.txt`, "AAA"); | ||
const sha2 = gitCommitAll(cwd, "feat(aaa): Add missing text file"); | ||
const url = gitInitOrigin(cwd); | ||
gitPush(cwd); | ||
|
||
// Capture output. | ||
const stdout = new WritableStreamBuffer(); | ||
const stderr = new WritableStreamBuffer(); | ||
|
||
// Call multiSemanticRelease() | ||
// Doesn't include plugins that actually publish. | ||
const multiSemanticRelease = require("../../"); | ||
const result = await multiSemanticRelease( | ||
[`packages/c/package.json`, `packages/d/package.json`], | ||
{}, | ||
{ cwd, stdout, stderr }, | ||
{ deps: {}, dryRun: false, sequentialPrepare: true } | ||
); | ||
|
||
// Get stdout and stderr output. | ||
const err = stderr.getContentsAsString("utf8"); | ||
expect(err).toBe(false); | ||
const out = stdout.getContentsAsString("utf8"); | ||
expect(out).toMatch("Started multirelease! Loading 2 packages..."); | ||
expect(out).toMatch("Loaded package msr-test-c"); | ||
expect(out).toMatch("Loaded package msr-test-d"); | ||
expect(out).toMatch("Queued 2 packages! Starting release..."); | ||
expect(out).toMatch("Created tag [email protected]"); | ||
expect(out).toMatch("Released 1 of 2 packages, semantically!"); | ||
|
||
// C. | ||
expect(result[0].name).toBe("msr-test-c"); | ||
expect(result[0].result.lastRelease).toMatchObject({ | ||
gitHead: sha1, | ||
gitTag: "[email protected]", | ||
version: "1.0.0", | ||
}); | ||
expect(result[0].result.nextRelease).toMatchObject({ | ||
gitHead: sha2, | ||
gitTag: "[email protected]", | ||
type: "minor", | ||
version: "1.1.0", | ||
}); | ||
|
||
// D. | ||
expect(result[1].name).toBe("msr-test-d"); | ||
expect(result[1].result.nextRelease).toBeUndefined(); | ||
|
||
// ONLY three times. | ||
expect(result[2]).toBe(undefined); | ||
}); | ||
|
||
test("Changes in some packages (sequential-init)", async () => { | ||
// Create Git repo. | ||
const cwd = gitInit(); | ||
|