-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-plugin.js
More file actions
34 lines (27 loc) · 990 Bytes
/
test-plugin.js
File metadata and controls
34 lines (27 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Test script for the plugin system
import { Installer } from './dist/install.js';
import { pluginManager, PluginHook } from './dist/plugin.js';
async function testPlugin() {
try {
console.log('Initializing plugin manager...');
await pluginManager.init(process.cwd());
console.log('Testing plugin hooks directly...');
// Create a test context
const context = {
projectDir: process.cwd(),
nodeModulesPath: `${process.cwd()}/node_modules`,
dependencies: { chalk: '^5.0.0' },
packageManager: 'npm'
};
// Test preInstall hook
console.log('\nTesting preInstall hook:');
await pluginManager.runHook(PluginHook.PRE_INSTALL, context);
// Test postInstall hook
console.log('\nTesting postInstall hook:');
await pluginManager.runHook(PluginHook.POST_INSTALL, context);
console.log('\nPlugin hook testing completed');
} catch (error) {
console.error('Error:', error);
}
}
testPlugin().catch(console.error);