Skip to content

Commit

Permalink
add symlink test
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jun 24, 2020
1 parent 3cea30e commit fa308bf
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/core/server/plugins/discovery/plugins_discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,39 @@ describe('plugins discovery system', () => {
);
});

it('works with symlinks', async () => {
const { plugin$ } = discover(new PluginsConfig(pluginConfig, env), coreContext);

const pluginFolder = resolve(KIBANA_ROOT, '..', 'ext-plugins');

mockFs(
{
[KIBANA_ROOT]: {
src: {
plugins: {},
},
plugins: mockFs.symlink({
path: '../ext-plugins',
}),
'x-pack': {
plugins: {},
},
},
[pluginFolder]: {
plugin_a: Plugins.valid('pluginA'),
plugin_b: Plugins.valid('pluginB'),
},
},
{ createCwd: false }
);

const plugins = await plugin$.pipe(toArray()).toPromise();
const pluginNames = plugins.map((plugin) => plugin.name);

expect(pluginNames).toHaveLength(2);
expect(pluginNames).toEqual(expect.arrayContaining(['pluginA', 'pluginB']));
});

it('logs a warning about --plugin-path when used in development', async () => {
const extraPluginTestPath = resolve(process.cwd(), 'my-extra-plugin');

Expand Down

0 comments on commit fa308bf

Please sign in to comment.