@apica-io/asm-playwright-runner 1.0.0-dev.5 → 1.0.0-dev.6
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/package.json +1 -1
- package/src/runner.ts +6 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apica-io/asm-playwright-runner",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.6",
|
|
4
4
|
"description": "CLI wrapper for Playwright collections or scripts with dynamic actions, config, and test result models.",
|
|
5
5
|
"main": "dist/cli/index.js",
|
|
6
6
|
"bin": {
|
package/src/runner.ts
CHANGED
|
@@ -240,27 +240,17 @@ export class PlaywrightRunner {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
private async detectScriptType(collectionPath: string): Promise<ScriptType | undefined> {
|
|
243
|
-
|
|
244
|
-
const mod = await import(path.resolve(collectionPath));
|
|
245
|
-
this.logger.debug("mod", mod, collectionPath)
|
|
246
|
-
if (typeof mod.default === "function") {
|
|
247
|
-
this.logger.debug("Detected plain Playwright script (default export).");
|
|
248
|
-
return ScriptType.PLAYWRIGHT;
|
|
249
|
-
}
|
|
250
|
-
} catch {
|
|
251
|
-
this.logger.debug("Dynamic import failed, falling back to file content check.");
|
|
252
|
-
}
|
|
243
|
+
const fileContent = fs.readFileSync(collectionPath, "utf-8");
|
|
253
244
|
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
return ScriptType.JSON;
|
|
245
|
+
if (fileContent.includes("export default")) {
|
|
246
|
+
return ScriptType.PLAYWRIGHT;
|
|
257
247
|
}
|
|
258
|
-
|
|
259
|
-
const fileContent = fs.readFileSync(collectionPath, "utf-8");
|
|
260
248
|
if (fileContent.includes("test(")) {
|
|
261
|
-
this.logger.debug("Detected Playwright Test file.");
|
|
262
249
|
return ScriptType.PLAYWRIGHT_TEST;
|
|
263
250
|
}
|
|
251
|
+
if (collectionPath.endsWith(".json")) {
|
|
252
|
+
return ScriptType.JSON;
|
|
253
|
+
}
|
|
264
254
|
|
|
265
255
|
return undefined;
|
|
266
256
|
}
|