MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / loadPluginAsync

Function loadPluginAsync

lib/container.js:694–710  ·  view source on GitHub ↗
(modulePath, config)

Source from the content-addressed store, hash-verified

692}
693
694async function loadPluginAsync(modulePath, config) {
695 let pluginMod
696 try {
697 // Try dynamic import first (works for both ESM and CJS)
698 const resolvedPath = resolveImportModulePath(modulePath)
699 pluginMod = await import(resolvedPath)
700 } catch (err) {
701 throw new Error(`Could not load plugin from '${modulePath}': ${err.message}`)
702 }
703
704 const pluginFactory = pluginMod.default || pluginMod
705 if (typeof pluginFactory !== 'function') {
706 throw new Error(`Plugin '${modulePath}' is not a function. Expected a plugin factory function.`)
707 }
708
709 return pluginFactory(config)
710}
711
712async function loadPluginFallback(modulePath, config) {
713 // This function is kept for backwards compatibility but now uses dynamic import

Callers 2

loadPluginFallbackFunction · 0.85
createPluginsFunction · 0.85

Calls 1

resolveImportModulePathFunction · 0.90

Tested by

no test coverage detected