Skip to content

Commit

Permalink
fix: make defaultTag required
Browse files Browse the repository at this point in the history
This more closely aligns the test behavior with how it is actually called.
The release.yml workflow always passed in a tag.
  • Loading branch information
lukekarrys committed Nov 28, 2023
1 parent 6797112 commit 26c9641
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
2 changes: 0 additions & 2 deletions lib/content/release-please-config-json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"pull-request-title-pattern": "chore: release${component} ${version}",
"changelog-sections": {{{ json changelogTypes }}},
"prerelease-type": "pre",
"pull-request-header": " ",
"pull-request-footer": " ",
"packages": {
"{{ pkgPath }}": {
{{#if isRoot}}
Expand Down
5 changes: 2 additions & 3 deletions lib/release/release-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ReleaseManager {
cwd = process.cwd(),
pr,
backport,
defaultTag = 'latest',
defaultTag,
lockfile,
publish,
silent,
Expand All @@ -36,6 +36,7 @@ class ReleaseManager {
assert(repo, 'GITHUB_REPOSITORY is required')
assert(cwd, 'cwd is required')
assert(pr, 'pr is required')
assert(defaultTag, 'defaultTag is required')

this.#octokit = new Octokit({ auth: token })
this.#owner = repo.split('/')[0]
Expand Down Expand Up @@ -167,8 +168,6 @@ class ReleaseManager {

this.#info(`Fetching release process from repo wiki: ${this.#owner}/${this.#repo}`)

console.log(this.#owner, this.#repo)

const releaseProcess = await fetch(
`https://raw.githubusercontent.com/wiki/${this.#owner}/${this.#repo}/Release-Process.md`
)
Expand Down
3 changes: 2 additions & 1 deletion lib/release/release-please.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ class ReleasePlease {
repo,
branch,
backport,
defaultTag = 'latest',
defaultTag,
overrides,
silent,
trace,
}) {
assert(token, 'token is required')
assert(repo, 'repo is required')
assert(branch, 'branch is required')
assert(defaultTag, 'defaultTag is required')

this.#token = token
this.#owner = repo.split('/')[0]
Expand Down
4 changes: 1 addition & 3 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@
},
"group-pull-request-title-pattern": "chore: release ${version}",
"pull-request-title-pattern": "chore: release${component} ${version}",
"prerelease-type": "pre",
"pull-request-header": " ",
"pull-request-footer": " "
"prerelease-type": "pre"
}
6 changes: 0 additions & 6 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,8 +1388,6 @@ release-please-config.json
}
],
"prerelease-type": "pre",
"pull-request-header": " ",
"pull-request-footer": " ",
"packages": {
".": {
"package-name": ""
Expand Down Expand Up @@ -3044,8 +3042,6 @@ release-please-config.json
}
],
"prerelease-type": "pre",
"pull-request-header": " ",
"pull-request-footer": " ",
"packages": {
".": {
"package-name": "",
Expand Down Expand Up @@ -4417,8 +4413,6 @@ release-please-config.json
}
],
"prerelease-type": "pre",
"pull-request-header": " ",
"pull-request-footer": " ",
"packages": {
"workspaces/a": {},
"workspaces/b": {}
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/mock-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const releasePlease = async (t, { setup: s, ...opts } = {}) => {
branch: BRANCH,
silent: !s.record,
trace: true,
defaultTag: 'latest',
...opts,
})
} catch (e) {
Expand All @@ -90,6 +91,7 @@ const releaseManager = (t, {
repo: REPO,
silent: !s.record,
cwd,
defaultTag: 'latest',
...opts,
})
}
Expand Down
1 change: 1 addition & 0 deletions test/release/release-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ t.test('init', async t => {
repo: 'ok',
pr: 'ok',
silent: false,
defaultTag: 'latest',
}))
})

Expand Down
11 changes: 6 additions & 5 deletions test/release/release-please.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ const { releasePlease, setup, BRANCH, REPO_DIR } = require('../fixtures/mock-rel
const { join, resolve } = require('path')

t.test('init', async t => {
t.rejects(ReleasePlease.run())
t.rejects(ReleasePlease.run({}))
t.rejects(ReleasePlease.run({ token: 'ok' }))
t.rejects(ReleasePlease.run({ token: 'ok', repo: 'ok' }))
t.rejects(new ReleasePlease({
await t.rejects(ReleasePlease.run())
await t.rejects(ReleasePlease.run({}))
await t.rejects(ReleasePlease.run({ token: 'ok' }))
await t.rejects(ReleasePlease.run({ token: 'ok', repo: 'ok' }))
await t.rejects(new ReleasePlease({
token: 'ok',
repo: 'ok',
branch: 'ok',
defaultTag: 'ok',
}).init())
})

Expand Down

0 comments on commit 26c9641

Please sign in to comment.