@apica-io/asm-playwright-runner 1.0.0-dev.5 → 1.0.0-dev.7

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