Plugins
The Plugins package is a kernel responsible to manage the interactions with the plugins. Refer to Plugin dependencies for an example.
Plugins helper
The pluginsHelper exposes an API to handle all the actions related with the plugins management. Most of the API works through actions and selectors.
getError
Plugins may fail when starting. If they do, we can recover the error through the getError.
Usage
Copy
const error = pluginsHelper.getError(pluginName: string): Error?
-
pluginName String
The name of the plugin that we want to look for errors.
Returns
-
Error | null
The error of the plugin during initialization or null if there was no error.

Retrieves the error of the plugin that failed to start.
spec.js
Copy
import { tryAddPluginFail } from './PluginFail.js';
import { addPluginGetError } from './PluginGetError.js';
test('retrieves the error of the plugin that failed to start', () => {
tryAddPluginFail();
const example = addPluginGetError();
expect(example.getError('plugin-fail')).toMatchObject({
message: 'This plugin failed to start, it is PluginFail',
});
});
PluginFail.js
Copy
import { addPlugin } from '@orion/core/test-utils';
class PluginFail {
constructor() {
throw new Error('This plugin failed to start, it is PluginFail');
}
}
export function tryAddPluginFail() {
try {
addPlugin({ name: 'plugin-fail', version: '1.0.0' }, PluginFail);
} catch (muteError) {}
}
PluginGetError.js
Copy
import { addPlugin } from '@orion/core/test-utils';
class PluginGetError {
constructor({ pluginsHelper }) {
this._pluginsHelper = pluginsHelper;
}
getError(pluginName) {
return this._pluginsHelper.getError(pluginName);
}
}
export function addPluginGetError() {
return addPlugin({ name: 'plugin-geterror', version: '1.0.0' }, PluginGetError);
}