mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
feat(CLI): Introduce deprecation for duplicate plugin definition
This commit is contained in:
parent
4da0899673
commit
d2a75ea95e
@ -36,6 +36,14 @@ Note:
|
||||
- In service configuration setting is ineffective for deprecations reported before service configuration is read.
|
||||
- `SLS_DEPRECATION_DISABLE` env var and `disabledDeprecations` configuration setting remain respected, and no errors will be thrown for mentioned deprecation coodes.
|
||||
|
||||
<a name="DUPLICATE_PLUGIN_DEFINITION"><div> </div></a>
|
||||
|
||||
## Duplicate plugin definition in configuration
|
||||
|
||||
Deprecation code: `DUPLICATE_PLUGIN_DEFINITION`
|
||||
|
||||
Starting with "v3.0.0", duplicate plugin definition will result in an error instead of a warning. To ensure seamless upgrade, please remove duplicate plugins from your configuration.
|
||||
|
||||
<a name="CLI_VERBOSE_OPTION_ALIAS"><div> </div></a>
|
||||
|
||||
## CLI `-v` alias for `--verbose` option
|
||||
|
||||
@ -133,9 +133,9 @@ class PluginManager {
|
||||
|
||||
// don't load plugins twice
|
||||
if (this.plugins.some((plugin) => plugin instanceof Plugin)) {
|
||||
legacy.log(`WARNING: duplicate plugin ${Plugin.name} was not loaded\n`);
|
||||
log.warning(
|
||||
`Duplicate plugin definition found in your configuration. Plugin "${Plugin.name}" will not be loaded more than once.`
|
||||
this.serverless._logDeprecation(
|
||||
'DUPLICATE_PLUGIN_DEFINITION',
|
||||
'Starting with "v3.0.0", duplicate plugin definition will result in an error instead of a warning. To ensure seamless upgrade, please remove duplicate plugins from your configuration.'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -568,14 +568,6 @@ describe('PluginManager', () => {
|
||||
expect(pluginManager.plugins[0]).to.be.instanceof(SynchronousPluginMock);
|
||||
});
|
||||
|
||||
it('should not load plugins twice', () => {
|
||||
pluginManager.addPlugin(SynchronousPluginMock);
|
||||
pluginManager.addPlugin(SynchronousPluginMock);
|
||||
|
||||
expect(pluginManager.plugins[0]).to.be.instanceof(SynchronousPluginMock);
|
||||
expect(pluginManager.plugins.length).to.equal(1);
|
||||
});
|
||||
|
||||
it('should load two plugins that happen to have the same class name', () => {
|
||||
function getFirst() {
|
||||
return class PluginMock {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user