-
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.
feat: add sequential-init flag to avoid hypothetical concurrent initi…
…alization collisions relates dhoulb/multi-semantic-release#24
- Loading branch information
1 parent
c7ec00a
commit 348678e
Showing
5 changed files
with
85 additions
and
8 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
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
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 |
---|---|---|
|
@@ -329,6 +329,62 @@ describe("multiSemanticRelease()", () => { | |
}, | ||
}); | ||
}); | ||
test("Changes in some packages (sequential-init)", async () => { | ||
// Create Git repo. | ||
const cwd = gitInit(); | ||
// Initial commit. | ||
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); | ||
const sha1 = gitCommitAll(cwd, "feat: Initial release"); | ||
gitTag(cwd, "[email protected]"); | ||
gitTag(cwd, "[email protected]"); | ||
gitTag(cwd, "[email protected]"); | ||
gitTag(cwd, "[email protected]"); | ||
// Second commit. | ||
writeFileSync(`${cwd}/packages/a/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`, | ||
`packages/b/package.json`, | ||
`packages/a/package.json`, | ||
], | ||
{}, | ||
{ cwd, stdout, stderr }, | ||
{ sequentialInit: true } | ||
); | ||
|
||
// Check manifests. | ||
expect(require(`${cwd}/packages/a/package.json`)).toMatchObject({ | ||
peerDependencies: { | ||
"msr-test-c": "1.0.1", | ||
}, | ||
}); | ||
expect(require(`${cwd}/packages/b/package.json`)).toMatchObject({ | ||
dependencies: { | ||
"msr-test-a": "1.1.0", | ||
}, | ||
devDependencies: { | ||
"msr-test-c": "1.0.1", | ||
}, | ||
}); | ||
expect(require(`${cwd}/packages/c/package.json`)).toMatchObject({ | ||
devDependencies: { | ||
"msr-test-b": "1.0.1", | ||
"msr-test-d": "1.0.0", | ||
}, | ||
}); | ||
}); | ||
test("Error if release's local deps have no version number", async () => { | ||
// Create Git repo with copy of Yarn workspaces fixture. | ||
const cwd = gitInit(); | ||
|