-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathrelease-config.js
35 lines (30 loc) · 1.07 KB
/
release-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const t = require('tap')
const setup = require('../setup.js')
const PLUGINS = ['node-workspace', 'node-workspace-format']
t.test('root only', async t => {
const prvt = { private: true }
const cases = [
[{}, { plugins: false, pr: true }],
[{ workspaces: { a: 'a' } }, { plugins: true, pr: true }],
[{ workspaces: { a: prvt } }, { plugins: false, pr: true }],
[{ package: prvt }, { plugins: false, pr: false }],
[
{ package: prvt, workspaces: { a: 'a' } },
{ plugins: true, pr: true },
],
[
{ package: prvt, workspaces: { a: prvt } },
{ plugins: false, pr: false },
],
]
for (const [config, expected] of cases) {
await t.test(JSON.stringify(config), async t => {
const s = await setup(t, config)
await s.apply()
const releaseConfig = await s.readJson('release-please-config.json').catch(() => ({}))
const pr = await s.exists('.github', 'workflows', 'pull-request.yml')
t.strictSame(releaseConfig.plugins, expected.plugins ? PLUGINS : undefined)
t.equal(pr, expected.pr)
})
}
})