本文整理匯總了TypeScript中@oclif/test.test類的典型用法代碼示例。如果您正苦於以下問題:TypeScript test類的具體用法?TypeScript test怎麽用?TypeScript test使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了test類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: runtest
runtest('autocomplete:script', () => {
test
.stdout()
.command(['autocomplete:script', 'bash'])
.it('outputs bash profile config', ctx => {
expect(ctx.stdout).to.contain(`
# heroku autocomplete setup
HEROKU_AC_BASH_SETUP_PATH=${
ctx.config.cacheDir
}/autocomplete/bash_setup && test -f $HEROKU_AC_BASH_SETUP_PATH && source $HEROKU_AC_BASH_SETUP_PATH;
`
)
})
test
.stdout()
.command(['autocomplete:script', 'zsh'])
.it('outputs zsh profile config', ctx => {
expect(ctx.stdout).to.contain(`
# heroku autocomplete setup
HEROKU_AC_ZSH_SETUP_PATH=${
ctx.config.cacheDir
}/autocomplete/zsh_setup && test -f $HEROKU_AC_ZSH_SETUP_PATH && source $HEROKU_AC_ZSH_SETUP_PATH;
`
)
})
test
.stdout()
.command(['autocomplete:script', 'fish'])
.catch(e => {
expect(e.message).to.contain('fish is not a supported shell for autocomplete')
})
.it('errors on unsupported shell')
})
示例2: describe
describe('livestreamer-twitch-followed', () => {
test
.stdout()
.do(() => cmd.run([]))
.it('runs hello', ctx => {
expect(ctx.stdout).to.contain('hello world')
})
test
.stdout()
.do(() => cmd.run(['--name', 'jeff']))
.it('runs hello --name jeff', ctx => {
expect(ctx.stdout).to.contain('hello jeff')
})
})
示例3: describe
describe('without specifying an app', () => {
test
.stderr()
.command(['ps:autoscale:enable', '--min', '1', '--max', '2'])
.catch(err => expect(err.message).to.contain('--app'))
.it('aborts the command')
})
示例4: commonSetup
function commonSetup() {
return test
.stderr()
.nock(API_HOST, api => api
.get(`/apps/${APP_NAME}`)
.reply(200, {id: APP_ID, name: APP_NAME})
)
}
示例5: describe
describe('ps:autoscale:disable without a web dyno/monitor', () => {
test
.stderr()
.nock(API_HOST, api => api
.get(`/apps/${APP_NAME}`)
.reply(200, {id: APP_ID, name: APP_NAME})
)
.nock(METRICS_HOST, api => api
.get(`/apps/${APP_ID}/formation/web/monitors`)
.reply(200, [])
)
.command(['ps:autoscale:disable', '--app', APP_NAME])
.catch(err => expect(err.message).to.contain(`${APP_NAME} does not have autoscale enabled`))
.it('throws an error')
})
示例6: describe
import Nock from '@fancy-test/nock'
import * as Test from '@oclif/test'
import * as git from '../../../src/utils/git'
const test = Test.test
.register('nock', Nock)
const expect = Test.expect
describe('ci:rerun', () => {
test
.command(['ci:rerun'])
.catch(e => {
expect(e.message).to.contain('Required flag: --pipeline PIPELINE or --app APP')
})
.it('errors when not specifying a pipeline or an app')
describe('when specifying a pipeline', () => {
const pipeline = {id: '14402644-c207-43aa-9bc1-974a34914010', name: 'pipeline'}
const ghRepository = {
user: 'heroku-fake', repo: 'my-repo', ref: '668a5ce22eefc7b67c84c1cfe3a766f1958e0add', branch: 'my-test-branch'
}
const oldTestRun = {
commit_branch: ghRepository.branch,
commit_message: 'earlier commit',
commit_sha: '2F3CAFFD6AEEC967A7D71EB7ABEC0993D036430691E668A8710248DF4541111E',
id: 'd76b690b-a4ce-4a7b-83ca-c30792d4f3be',
number: 10,
pipeline: {id: pipeline.id},
status: 'failed'
}
示例7: nock
import * as nock from 'nock'
import Nock from '@fancy-test/nock'
import {expect, test as base} from '@oclif/test'
const test = base
.register('nock', Nock)
let api = nock('https://status.heroku.com:443')
beforeEach(() => nock.cleanAll())
afterEach(() => api.done())
const time = new Date()
describe('when heroku is green', () => {
test
.stdout()
.nock('https://status.heroku.com', api => {
api.get('/api/v4/current-status').reply(200, {
status: [
{system: 'Apps', status: 'green'},
{system: 'Data', status: 'green'},
{system: 'Tools', status: 'green'},
],
incidents: [],
scheduled: [],
})
})
.command(['status'])
.it('shows success message', ctx => {
示例8: describe
import Nock from '@fancy-test/nock'
import {Fixture} from '@heroku/buildpack-registry'
import {expect, test as otest} from '@oclif/test'
import * as nock from 'nock'
// tslint:disable-next-line:no-duplicate-imports
import {Scope} from 'nock'
nock.disableNetConnect()
const test = otest.register('nock', Nock)
describe('buildpacks:search', () => {
test
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
api
.get('/buildpacks?in[namespace][]=heroku')
.reply(200, [
Fixture.buildpack({
name: 'ruby',
description: 'Official Heroku Buildpack for Ruby',
})
])
})
.stdout()
.command(['buildpacks:search', '--namespace', 'heroku'])
.it('searches using the namespace', ctx => {
expect(ctx.stdout).to.contain('heroku/ruby')
expect(ctx.stdout).to.contain('1 buildpack found')
})
test
.nock('https://buildpack-registry.heroku.com', (api: Scope) => {
let rubyBuildpack = Fixture.buildpack({
示例9: describe
describe('certs:auto:wait', () => {
test
.stdout()
.it('runs certs:auto:wait', () => { })
})