@apica-io/asm-playwright-runner 1.0.0-dev.4 → 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/dist/runner.js CHANGED
@@ -236,6 +236,7 @@ class PlaywrightRunner {
236
236
  async detectScriptType(collectionPath) {
237
237
  try {
238
238
  const mod = await Promise.resolve(`${path_1.default.resolve(collectionPath)}`).then(s => __importStar(require(s)));
239
+ this.logger.debug("mod", mod, collectionPath);
239
240
  if (typeof mod.default === "function") {
240
241
  this.logger.debug("Detected plain Playwright script (default export).");
241
242
  return runnerConfig_1.ScriptType.PLAYWRIGHT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apica-io/asm-playwright-runner",
3
- "version": "1.0.0-dev.4",
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,26 +240,17 @@ export class PlaywrightRunner {
240
240
  }
241
241
 
242
242
  private async detectScriptType(collectionPath: string): Promise<ScriptType | undefined> {
243
- try {
244
- const mod = await import(path.resolve(collectionPath));
245
- if (typeof mod.default === "function") {
246
- this.logger.debug("Detected plain Playwright script (default export).");
247
- return ScriptType.PLAYWRIGHT;
248
- }
249
- } catch {
250
- this.logger.debug("Dynamic import failed, falling back to file content check.");
251
- }
243
+ const fileContent = fs.readFileSync(collectionPath, "utf-8");
252
244
 
253
- if (collectionPath.endsWith(".json")) {
254
- this.logger.debug("Detected JSON flow.");
255
- return ScriptType.JSON;
245
+ if (fileContent.includes("export default")) {
246
+ return ScriptType.PLAYWRIGHT;
256
247
  }
257
-
258
- const fileContent = fs.readFileSync(collectionPath, "utf-8");
259
248
  if (fileContent.includes("test(")) {
260
- this.logger.debug("Detected Playwright Test file.");
261
249
  return ScriptType.PLAYWRIGHT_TEST;
262
250
  }
251
+ if (collectionPath.endsWith(".json")) {
252
+ return ScriptType.JSON;
253
+ }
263
254
 
264
255
  return undefined;
265
256
  }