testblocks 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/server/plugins.js +15 -3
- package/package.json +3 -2
package/dist/cli/index.js
CHANGED
|
@@ -230,7 +230,7 @@ program
|
|
|
230
230
|
'test:junit': 'testblocks run tests/**/*.testblocks.json -r junit -o reports',
|
|
231
231
|
},
|
|
232
232
|
devDependencies: {
|
|
233
|
-
testblocks: '^0.
|
|
233
|
+
testblocks: '^0.5.0',
|
|
234
234
|
},
|
|
235
235
|
};
|
|
236
236
|
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
|
package/dist/server/plugins.js
CHANGED
|
@@ -54,7 +54,12 @@ exports.getServerPlugins = getServerPlugins;
|
|
|
54
54
|
exports.isPluginLoaded = isPluginLoaded;
|
|
55
55
|
const fs = __importStar(require("fs"));
|
|
56
56
|
const path = __importStar(require("path"));
|
|
57
|
+
const jiti_1 = require("jiti");
|
|
57
58
|
const core_1 = require("../core");
|
|
59
|
+
// Create jiti instance for loading TypeScript plugins at runtime
|
|
60
|
+
const jiti = (0, jiti_1.createJiti)(__filename, {
|
|
61
|
+
interopDefault: true,
|
|
62
|
+
});
|
|
58
63
|
// Track initialization
|
|
59
64
|
let pluginsInitialized = false;
|
|
60
65
|
// List of registered plugins
|
|
@@ -135,12 +140,13 @@ async function loadPlugin(pluginName) {
|
|
|
135
140
|
const jsPath = path.join(pluginsDirectory, `${pluginName}.js`);
|
|
136
141
|
const tsPath = path.join(pluginsDirectory, `${pluginName}.ts`);
|
|
137
142
|
let pluginPath = null;
|
|
143
|
+
let isTypeScript = false;
|
|
138
144
|
if (fs.existsSync(jsPath)) {
|
|
139
145
|
pluginPath = jsPath;
|
|
140
146
|
}
|
|
141
147
|
else if (fs.existsSync(tsPath)) {
|
|
142
|
-
// For TypeScript files, require ts-node or esbuild-register
|
|
143
148
|
pluginPath = tsPath;
|
|
149
|
+
isTypeScript = true;
|
|
144
150
|
}
|
|
145
151
|
if (!pluginPath) {
|
|
146
152
|
console.error(`Plugin not found: ${pluginName} (looked in ${pluginsDirectory})`);
|
|
@@ -148,8 +154,14 @@ async function loadPlugin(pluginName) {
|
|
|
148
154
|
}
|
|
149
155
|
try {
|
|
150
156
|
console.log(`Loading plugin: ${pluginName} from ${pluginPath}`);
|
|
151
|
-
//
|
|
152
|
-
|
|
157
|
+
// Use jiti for TypeScript files, dynamic import for JavaScript
|
|
158
|
+
let module;
|
|
159
|
+
if (isTypeScript) {
|
|
160
|
+
module = jiti(pluginPath);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
module = await Promise.resolve(`${pluginPath}`).then(s => __importStar(require(s)));
|
|
164
|
+
}
|
|
153
165
|
// Look for default export or named export matching plugin name
|
|
154
166
|
const plugin = module.default ||
|
|
155
167
|
module[pluginName.replace(/-./g, x => x[1].toUpperCase()) + 'Plugin'] ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testblocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Visual test automation tool with Blockly - API and Playwright testing",
|
|
5
5
|
"author": "Roy de Kleijn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"cors": "^2.8.5",
|
|
71
71
|
"express": "^4.21.2",
|
|
72
72
|
"glob": "^11.0.0",
|
|
73
|
+
"jiti": "^2.6.1",
|
|
73
74
|
"jsonpath-plus": "^10.3.0",
|
|
74
75
|
"otpauth": "^9.4.1",
|
|
75
76
|
"playwright": "^1.49.1",
|
|
@@ -79,7 +80,6 @@
|
|
|
79
80
|
"xpath": "^0.0.34"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@vitest/coverage-v8": "^2.1.8",
|
|
83
83
|
"@eslint/js": "^9.39.2",
|
|
84
84
|
"@types/cors": "^2.8.17",
|
|
85
85
|
"@types/express": "^5.0.0",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
91
91
|
"@typescript-eslint/parser": "^8.51.0",
|
|
92
92
|
"@vitejs/plugin-react": "^4.3.4",
|
|
93
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
93
94
|
"concurrently": "^8.2.2",
|
|
94
95
|
"eslint": "^9.39.2",
|
|
95
96
|
"eslint-plugin-react": "^7.37.5",
|