Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/DeployServiceCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const { Flags } = require('@oclif/core')

const { PropertyDefault } = require('./properties')
const runtimeLib = require('@adobe/aio-lib-runtime')
const { getToken, context, CLI } = require('@adobe/aio-lib-ims')
const { getToken, context } = require('@adobe/aio-lib-ims')
const { CLI } = require('@adobe/aio-lib-ims/src/context')
const { getCliEnv } = require('@adobe/aio-lib-env')
const RuntimeBaseCommand = require('./RuntimeBaseCommand')

Expand All @@ -38,7 +39,7 @@ class DeployServiceCommand extends RuntimeBaseCommand {
let contextName = CLI // default
const currentContext = await context.getCurrent() // potential override

if (currentContext !== CLI) {
if (currentContext && currentContext !== CLI) {
contextName = currentContext
} else {
await context.setCli({ 'cli.bare-output': true }, false) // set this globally
Expand Down
4 changes: 2 additions & 2 deletions test/DeployServiceCommand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ describe('DeployServiceCommand', () => {
getCliEnv.mockReturnValue(mockEnv)
})

test('should use CLI context by default', async () => {
context.getCurrent.mockResolvedValue(CLI)
test('should use CLI context (default) if current context undefined', async () => {
context.getCurrent.mockResolvedValue(undefined)
getToken.mockResolvedValue(mockToken)

const result = await command.getAccessToken()
Expand Down