Skip to content

Commit

Permalink
fix(Telemetry): Properly handle not in service dir in credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Jul 2, 2021
1 parent 3e14f06 commit b21c1e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/cli/interactive-setup/aws-credentials.js
Expand Up @@ -319,7 +319,13 @@ const steps = {

module.exports = {
async isApplicable(context) {
const { configuration, history, options } = context;
const { configuration, history, options, serviceDir } = context;

if (!serviceDir) {
context.inapplicabilityReasonCode = 'NOT_IN_SERVICE_DIRECTORY';
return false;
}

if (
_.get(configuration, 'provider') !== 'aws' &&
_.get(configuration, 'provider.name') !== 'aws'
Expand Down
Expand Up @@ -57,7 +57,7 @@ describe('test/unit/lib/cli/interactive-setup/aws-credentials.test.js', () => {
it('Should be ineffective, when not at service path', async () => {
const context = {};
expect(await step.isApplicable(context)).to.equal(false);
expect(context.inapplicabilityReasonCode).to.equal('NON_AWS_PROVIDER');
expect(context.inapplicabilityReasonCode).to.equal('NOT_IN_SERVICE_DIRECTORY');
});

it('Should be ineffective, when not at AWS service', async () => {
Expand Down

0 comments on commit b21c1e4

Please sign in to comment.