-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test/prerelease test yarn #77
Open
virus2016
wants to merge
2
commits into
qiwi:master
Choose a base branch
from
virus2016:test/prereleaseTestYarn
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -80,6 +80,30 @@ test("Fetch only prerelease tags", async () => { | |
|
||
const tags = getTags("master", { cwd }, ["beta"]).sort(); | ||
expect(tags).toEqual(["[email protected]", "[email protected]"].sort()); | ||
|
||
// Add new testing files for a new release. | ||
createNewTestingFiles(packages, cwd); | ||
const shaPatch = gitCommitAll(cwd, "fix: add a patch"); | ||
expect(shaPatch).toBeTruthy(); | ||
gitPush(cwd); | ||
|
||
// Capture output. | ||
stdout = new WritableStreamBuffer(); | ||
stderr = new WritableStreamBuffer(); | ||
|
||
// Call multiSemanticRelease() for a second release | ||
// Doesn't include plugins that actually publish. | ||
// Change the master branch from release to prerelease to test bumping. | ||
await multiSemanticRelease( | ||
packages.map((folder) => `${folder}package.json`), | ||
{ | ||
branches: [{ name: "master", prerelease: "beta" }, { name: "release" }], | ||
}, | ||
{ cwd, stdout, stderr, env } | ||
); | ||
|
||
const tagsPatch = getTags("master", { cwd }, ["beta"]).sort(); | ||
expect(tagsPatch).toEqual(["[email protected]", "[email protected]", "[email protected]", "[email protected]"]); | ||
}); | ||
|
||
test("Throws error if obtaining the tags fails", () => { | ||
|
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 |
---|---|---|
|
@@ -382,7 +382,7 @@ describe("multiSemanticRelease()", () => { | |
result = await multiSemanticRelease( | ||
packages.map((folder) => `${folder}package.json`), | ||
{ | ||
branches: [{ name: "master", prerelease: "beta" }, { name: "release" }], | ||
branches: [{ name: "master", prerelease: "beta", channel: "beta" }, { name: "release" }], | ||
}, | ||
{ cwd, stdout, stderr, env } | ||
); | ||
|
@@ -434,7 +434,61 @@ describe("multiSemanticRelease()", () => { | |
"msr-test-d": "2.0.0-beta.1", | ||
}, | ||
}); | ||
}, 10000); | ||
|
||
// Add new testing files for a new release. | ||
createNewTestingFiles(packages, cwd); | ||
const shaPatch = gitCommitAll(cwd, "fix: add a patch"); | ||
expect(shaPatch).toBeTruthy(); | ||
gitPush(cwd); | ||
|
||
// Capture output. | ||
stdout = new WritableStreamBuffer(); | ||
stderr = new WritableStreamBuffer(); | ||
|
||
// Call multiSemanticRelease() for a second release | ||
// Doesn't include plugins that actually publish. | ||
// Change the master branch from release to prerelease to test bumping. | ||
result = await multiSemanticRelease( | ||
packages.map((folder) => `${folder}package.json`), | ||
{ | ||
branches: [{ name: "master", prerelease: "beta", channel: "beta" }, { name: "release" }], | ||
}, | ||
{ cwd, stdout, stderr, env } | ||
); | ||
|
||
// Get stdout and stderr output. | ||
const errpatch = stderr.getContentsAsString("utf8"); | ||
expect(errpatch).toBe(false); | ||
const outpatch = stdout.getContentsAsString("utf8"); | ||
expect(outpatch).toMatch("Started multirelease! Loading 2 packages..."); | ||
expect(outpatch).toMatch("Loaded package msr-test-c"); | ||
expect(outpatch).toMatch("Loaded package msr-test-d"); | ||
expect(outpatch).toMatch("Queued 2 packages! Starting release..."); | ||
expect(outpatch).toMatch("Created tag [email protected]"); | ||
expect(outpatch).toMatch("Created tag [email protected]"); | ||
expect(outpatch).toMatch("Released 2 of 2 packages, semantically!"); | ||
|
||
expect(result[0].name).toBe("msr-test-c"); | ||
expect(result[0].result.nextRelease).toMatchObject({ | ||
gitHead: shaPatch, | ||
gitTag: "[email protected]", | ||
type: "patch", | ||
version: "2.0.0-beta.2", | ||
}); | ||
|
||
expect(result[1].result.nextRelease.notes).toMatch("# msr-test-d [2.0.0-beta.2]"); | ||
|
||
// ONLY 1 time. | ||
expect(result).toHaveLength(2); | ||
|
||
expect(require(`${cwd}/packages/c/package.json`)).toMatchObject({ | ||
dependencies: { | ||
"msr-test-d": "2.0.0-beta.2", | ||
}, | ||
}); | ||
|
||
|
||
}, 20000); | ||
test("Two separate releases (changes in all packages with prereleases)", async () => { | ||
const packages = ["packages/a/", "packages/b/", "packages/c/", "packages/d/"]; | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that this test case contains a problem with module caching. If you use
readFileSync
instead ofrequire
, test case won't fail. Does https://github.com/qiwi/multi-semantic-release/pull/76/files still reproduce your error?