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
Add tests for release script #11454
Merged
sosukesuzuki
merged 14 commits into
prettier:main
from
sosukesuzuki:add-tests-for-release-scripts
Sep 7, 2021
Merged
Add tests for release script #11454
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
002e377
Install jest
sosukesuzuki 10f4052
Configure jest script
sosukesuzuki 231fb26
Fix eslintrc
sosukesuzuki 3887bf8
Add @types/jest
sosukesuzuki 756b657
Add test for validate-new-version
sosukesuzuki 2a349a8
Fix eslintrc
sosukesuzuki 4f0c281
Add workflow file
sosukesuzuki c21c901
Add node version
sosukesuzuki aad9006
cd to script/release
sosukesuzuki cbc9362
Fix workflow file
sosukesuzuki ebf62ba
Fix version
sosukesuzuki 9b71402
Ignore from root
sosukesuzuki 4224307
Update yarn.lock
sosukesuzuki 48fc148
Set defaults.run.working-directory
sosukesuzuki File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release_Script_Test | ||
|
||
on: | ||
push: | ||
paths: | ||
- "scripts/release/**" | ||
- ".github/workflows/release-script-test.yml" | ||
pull_request: | ||
paths: | ||
- "scripts/release/**" | ||
- ".github/workflows/release-script-test.yml" | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2.4.0 | ||
with: | ||
version: "14" | ||
cache: "yarn" | ||
|
||
- name: Install Dependencies | ||
run: cd scripts/release && yarn install --frozen-lockfile | ||
|
||
- name: Test | ||
run: cd scripts/release && yarn test |
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
15 changes: 15 additions & 0 deletions
15
scripts/release/__tests__/steps/validate-new-version.spec.js
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import chalk from "chalk"; | ||
import step from "../../steps/validate-new-version.js"; | ||
|
||
describe("validate-new-version", () => { | ||
it("throws error for invalid semver", () => { | ||
expect(() => { | ||
step({ version: "foo" }); | ||
}).toThrow("Invalid version specified"); | ||
}); | ||
it("throws error when version isn't greater than prev version", () => { | ||
expect(() => { | ||
step({ version: "0.0.1", previousVersion: "0.0.2" }); | ||
}).toThrow(`Version ${chalk.yellow("0.0.1")} has already been published`); | ||
}); | ||
}); |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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.
Can we use
working-directory
? https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrunThere 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.
48fc148 , works fine