Skip to content

Commit abc2deb

Browse files
committed
Update runcommand, tests
1 parent d877aa7 commit abc2deb

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

packages/cli/test/helpers/runCommand.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ const stopMock = () => {
1111
}
1212

1313
const runCommand = async (Cmd: GenericCmd, args: string[] = [], printStd = false) => {
14+
stdout.start()
15+
stderr.start()
1416
const conf = await getConfig()
1517
const instance = new Cmd(args, conf)
1618
if (printStd) {
1719
stdout.print = true
1820
stderr.print = true
1921
}
2022

21-
stdout.start()
22-
stderr.start()
23-
2423
return instance
2524
.run()
2625
.then(args => {

packages/cli/test/unit/commands/access/add.unit.test.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import Cmd from '../../../../src/commands/access/add.js'
55
import runCommand from '../../../helpers/runCommand.js'
66
import {personalApp, teamApp, teamFeatures} from '../../../helpers/stubs/get.js'
77
import {collaborators, teamAppCollaborators} from '../../../helpers/stubs/post.js'
8-
import expectOutput from '../../../helpers/utils/expectOutput.js'
9-
import tsheredoc from 'tsheredoc'
10-
const heredoc = tsheredoc.default
118

129
let apiGet: nock.Scope
1310
let apiPost: nock.Scope
@@ -36,9 +33,7 @@ describe('heroku access:add', function () {
3633
apiGet.done()
3734
apiGetOrgFeatures.done()
3835
apiPost.done()
39-
expectOutput(stderr.output, heredoc(`
40-
Adding [email protected] access to the app myapp with deploy, view permissions... done
41-
`))
36+
expect(stderr.output).to.include('Adding [email protected] access to the app myapp with deploy, view permissions... done')
4237
})
4338

4439
it('adds user to the app with permissions, and view is implicit', async function () {
@@ -52,10 +47,7 @@ describe('heroku access:add', function () {
5247
apiGet.done()
5348
apiGetOrgFeatures.done()
5449
apiPost.done()
55-
expectOutput(stderr.output, heredoc(`
56-
Adding [email protected] access to the app myapp with deploy, view permissions...
57-
Adding [email protected] access to the app myapp with deploy, view permissions... done
58-
`))
50+
expect(stderr.output).to.include('Adding [email protected] access to the app myapp with deploy, view permissions... done')
5951
})
6052

6153
it('raises an error when permissions are not specified', function () {
@@ -93,10 +85,7 @@ describe('heroku access:add', function () {
9385
apiGet.done()
9486
apiGetOrgFeatures.done()
9587
apiPost.done()
96-
expectOutput(stderr.output, heredoc(`
97-
Adding [email protected] access to the app myapp...
98-
Adding [email protected] access to the app myapp... done
99-
`))
88+
expect(stderr.output).to.include('Adding [email protected] access to the app myapp... done')
10089
})
10190
})
10291

@@ -118,10 +107,7 @@ describe('heroku access:add', function () {
118107
])
119108
apiGet.done()
120109
apiPost.done()
121-
expectOutput(stderr.output, heredoc(`
122-
Adding [email protected] access to the app myapp...
123-
Adding [email protected] access to the app myapp... done
124-
`))
110+
expect(stderr.output).to.include('Adding [email protected] access to the app myapp... done')
125111
})
126112
})
127113
})

packages/cli/test/unit/commands/access/update.unit.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('heroku access:update', function () {
2828
])
2929
expectOutput(stdout.output, '')
3030
expectOutput(stderr.output, heredoc(`
31-
Updating [email protected] in application myapp with deploy,view permissions...
3231
Updating [email protected] in application myapp with deploy,view permissions... done
3332
`))
3433
})
@@ -45,7 +44,6 @@ describe('heroku access:update', function () {
4544
])
4645
expectOutput(stdout.output, '')
4746
expectOutput(stderr.output, heredoc(`
48-
Updating [email protected] in application myapp with deploy,view permissions...
4947
Updating [email protected] in application myapp with deploy,view permissions... done
5048
`))
5149
})

0 commit comments

Comments
 (0)