diff --git a/lib/classes/PluginManager.js b/lib/classes/PluginManager.js index a1880ab7fd3..053a6f984db 100644 --- a/lib/classes/PluginManager.js +++ b/lib/classes/PluginManager.js @@ -373,7 +373,7 @@ class PluginManager { if (commands) { Object.entries(commands).forEach(([name, command]) => { if (command.type !== 'entrypoint') { - _.set(target, name, _.omit(command, 'commands')); + target[name] = _.omit(command, 'commands'); if ( Object.values(command.commands).some( (childCommand) => childCommand.type !== 'entrypoint' @@ -400,7 +400,7 @@ class PluginManager { } if (alias.command) { const commandPath = alias.command.split(':').join('.commands.'); - _.set(target, name, _.get(this.commands, commandPath)); + target[name] = _.get(this.commands, commandPath); } else { target[name] = target[name] || {}; target[name].commands = target[name].commands || {}; diff --git a/test/unit/lib/classes/PluginManager.test.js b/test/unit/lib/classes/PluginManager.test.js index 34b5bc0c500..a7db4b6b932 100644 --- a/test/unit/lib/classes/PluginManager.test.js +++ b/test/unit/lib/classes/PluginManager.test.js @@ -11,7 +11,6 @@ const Serverless = require('../../../../lib/Serverless'); const CLI = require('../../../../lib/classes/CLI'); const Create = require('../../../../lib/plugins/create/create'); -const _ = require('lodash'); const path = require('path'); const fs = require('fs'); const fse = require('fs-extra'); @@ -989,7 +988,7 @@ describe('PluginManager', () => { const consoleLogStub = sinon.stub(pluginManager.serverless.cli, 'log').returns(); const synchronousPluginMockInstance = new SynchronousPluginMock(); synchronousPluginMockInstance.commands.deploy.aliases = ['info']; - _.set(process.env, 'SLS_DEBUG', '*'); + process.env.SLS_DEBUG = '*'; pluginManager.loadCommands(synchronousPluginMockInstance); expect(consoleLogStub).to.have.been.calledWith(' -> @info'); }); diff --git a/test/unit/lib/plugins/aws/package/compile/functions.test.js b/test/unit/lib/plugins/aws/package/compile/functions.test.js index 99218878559..9364bd731bf 100644 --- a/test/unit/lib/plugins/aws/package/compile/functions.test.js +++ b/test/unit/lib/plugins/aws/package/compile/functions.test.js @@ -1129,11 +1129,9 @@ describe('AwsCompileFunctions', () => { Outputs: {}, }; - _.set( - awsCompileFunctions, - 'serverless.service.functions.func.environment.MY_ENV_VAR', - 'myvalue' - ); + awsCompileFunctions.serverless.service.functions.func.environment = { + MY_ENV_VAR: 'myvalue', + }; return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled; })