Skip to content

Commit

Permalink
feat: dumpconfig also dump disabled plugin (#4480)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 authored Sep 23, 2020
1 parent 1d32771 commit cc80c6a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/egg.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class EggApplication extends EggCore {
ignoreList = [];
}

const json = extend(true, {}, { config: this.config, plugins: this.plugins });
const json = extend(true, {}, { config: this.config, plugins: this.loader.allPlugins });
utils.convertObject(json, ignoreList);
return {
config: json,
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/apps/dumpconfig/config/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

exports.static = false;
2 changes: 1 addition & 1 deletion test/lib/core/loader/config_loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('test/lib/core/loader/config_loader.test.js', () => {
it('should get middlewares', async () => {
app = utils.app('apps/demo');
await app.ready();
assert.deepEqual(app.config.coreMiddleware.slice(0, 7), [
assert.deepStrictEqual(app.config.coreMiddleware.slice(0, 7), [
'meta',
'siteFile',
'notfound',
Expand Down
15 changes: 15 additions & 0 deletions test/lib/egg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,21 @@ describe('test/lib/egg.test.js', () => {
});
});

describe('dump disabled plugin', () => {
let app;
before(async () => {
app = utils.app('apps/dumpconfig');
await app.ready();
});
after(() => app.close());

it('should works', async () => {
const baseDir = utils.getFilepath('apps/dumpconfig');
const json = readJson(path.join(baseDir, 'run/application_config.json'));
assert(!json.plugins.static.enable);
});
});

describe('dumpConfig() dynamically', () => {
let app;
before(() => {
Expand Down

0 comments on commit cc80c6a

Please sign in to comment.