intellitester 0.2.26 → 0.2.28

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.
@@ -1276,7 +1276,7 @@ var execCommand = async (cmd, args, cwd) => {
1276
1276
  child.on("error", reject);
1277
1277
  });
1278
1278
  };
1279
- var buildAndPreview = async (config, cwd) => {
1279
+ var buildAndPreview = async (config, cwd, freshBuild = false) => {
1280
1280
  const pm = await detectPackageManager();
1281
1281
  const previewConfig = config?.preview || {};
1282
1282
  const buildCmd = previewConfig.build?.command || `${pm} run build`;
@@ -1285,9 +1285,19 @@ var buildAndPreview = async (config, cwd) => {
1285
1285
  const [previewExec, ...previewArgs] = previewCmd.split(" ");
1286
1286
  const previewUrl = previewConfig.url || config?.webServer?.url || config?.platforms?.web?.baseUrl || "http://localhost:4321";
1287
1287
  const timeout = previewConfig.timeout || 6e4;
1288
- console.log("\n\u{1F4E6} Building project...\n");
1289
- await execCommand(buildExec, buildArgs, cwd);
1290
- console.log("\n\u2705 Build complete\n");
1288
+ const fs4 = await import('fs/promises');
1289
+ const buildDirs = ["dist", "build", ".next", ".output", ".astro"];
1290
+ const hasArtifacts = await Promise.all(
1291
+ buildDirs.map((dir) => fs4.access(dir).then(() => true).catch(() => false))
1292
+ );
1293
+ const artifactsExist = hasArtifacts.some(Boolean);
1294
+ if (!artifactsExist || freshBuild) {
1295
+ console.log("\n\u{1F4E6} Building project...\n");
1296
+ await execCommand(buildExec, buildArgs, cwd);
1297
+ console.log("\n\u2705 Build complete\n");
1298
+ } else {
1299
+ console.log("\n\u23ED\uFE0F Skipping build (using existing artifacts)\n");
1300
+ }
1291
1301
  console.log("\n\u{1F680} Starting preview server...\n");
1292
1302
  const previewProcess = await startPreviewServer(previewExec, previewArgs, cwd, previewUrl, timeout);
1293
1303
  const cleanup = () => {
@@ -1781,14 +1791,14 @@ var main = async () => {
1781
1791
  process2__default.default.exitCode = 1;
1782
1792
  }
1783
1793
  });
1784
- program.command("run").description("Run test file(s), workflow, or auto-discover tests in tests/ directory").argument("[file]", "Test file, workflow, or pipeline to run (auto-discovers if omitted)").option("--visible", "Run browser in visible mode (not headless)").option("--browser <name>", "Browser to use (chrome, safari, firefox)", "chrome").option("--preview", "Build project and run against preview server").option("--no-server", "Skip auto-starting web server").option("-i, --interactive", "Interactive mode - AI suggests fixes on failure").option("--debug", "Debug mode - verbose logging").option("--session-id <id>", "Override test session ID (used for tracking/cleanup)").option("--track-dir <path>", "Directory for tracking files (defaults to .intellitester/track)").action(async (file, options) => {
1794
+ program.command("run").description("Run test file(s), workflow, or auto-discover tests in tests/ directory").argument("[file]", "Test file, workflow, or pipeline to run (auto-discovers if omitted)").option("--visible", "Run browser in visible mode (not headless)").option("--browser <name>", "Browser to use (chrome, safari, firefox)", "chrome").option("--preview", "Build project and run against preview server").option("--prod", "Alias for --preview - build and serve production build").option("--fresh-build", "Force a fresh build even if artifacts exist").option("--no-server", "Skip auto-starting web server").option("-i, --interactive", "Interactive mode - AI suggests fixes on failure").option("--debug", "Debug mode - verbose logging").option("--session-id <id>", "Override test session ID (used for tracking/cleanup)").option("--track-dir <path>", "Directory for tracking files (defaults to .intellitester/track)").action(async (file, options) => {
1785
1795
  let previewCleanup = null;
1786
1796
  try {
1787
1797
  const browser = resolveBrowserName(options.browser || "chrome");
1788
- if (options.preview) {
1798
+ if (options.preview || options.prod) {
1789
1799
  const hasConfigFile = await fileExists(CONFIG_FILENAME);
1790
1800
  const config = hasConfigFile ? await chunkDPT2LVTT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1791
- const { cleanup } = await buildAndPreview(config, process2__default.default.cwd());
1801
+ const { cleanup } = await buildAndPreview(config, process2__default.default.cwd(), options.freshBuild);
1792
1802
  previewCleanup = cleanup;
1793
1803
  }
1794
1804
  const runOpts = {