intellitester 0.2.33 → 0.2.35

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.
@@ -1798,7 +1798,15 @@ var main = async () => {
1798
1798
  if (options.preview || options.prod) {
1799
1799
  const hasConfigFile = await fileExists(CONFIG_FILENAME);
1800
1800
  const config = hasConfigFile ? await chunkDPT2LVTT_cjs.loadIntellitesterConfig(CONFIG_FILENAME) : void 0;
1801
- const { cleanup } = await buildAndPreview(config, process2__default.default.cwd(), options.freshBuild);
1801
+ const previewCwd = config?.webServer?.cwd ? path4__namespace.default.resolve(process2__default.default.cwd(), config.webServer.cwd) : process2__default.default.cwd();
1802
+ if (previewCwd !== process2__default.default.cwd()) {
1803
+ const appEnvPath = path4__namespace.default.join(previewCwd, ".env");
1804
+ if (await fileExists(appEnvPath)) {
1805
+ dotenv2__default.default.config({ path: appEnvPath, override: true });
1806
+ console.log(`Loaded .env from ${previewCwd}`);
1807
+ }
1808
+ }
1809
+ const { cleanup } = await buildAndPreview(config, previewCwd, options.freshBuild);
1802
1810
  previewCleanup = cleanup;
1803
1811
  }
1804
1812
  const runOpts = {
@@ -1865,6 +1873,73 @@ var main = async () => {
1865
1873
  console.error(`
1866
1874
  \u274C Test failed: ${path4__namespace.default.basename(test)}`);
1867
1875
  console.error(` ${error instanceof Error ? error.message : String(error)}
1876
+ `);
1877
+ failed = true;
1878
+ }
1879
+ }
1880
+ if (failed) {
1881
+ process2__default.default.exitCode = 1;
1882
+ }
1883
+ return;
1884
+ }
1885
+ const resolvedFile = path4__namespace.default.resolve(file);
1886
+ const fileStat = await fs3__default.default.stat(resolvedFile);
1887
+ if (fileStat.isDirectory()) {
1888
+ const discovered = await discoverTestFiles(resolvedFile);
1889
+ const total = discovered.pipelines.length + discovered.workflows.length + discovered.tests.length;
1890
+ if (total === 0) {
1891
+ logError(`No test files found in ${file}. Create .pipeline.yaml, .workflow.yaml, or .test.yaml files.`);
1892
+ process2__default.default.exit(1);
1893
+ }
1894
+ console.log(`Discovered ${total} test file(s) in ${file}:`);
1895
+ if (discovered.pipelines.length > 0) {
1896
+ console.log(` Pipelines: ${discovered.pipelines.length}`);
1897
+ }
1898
+ if (discovered.workflows.length > 0) {
1899
+ console.log(` Workflows: ${discovered.workflows.length}`);
1900
+ }
1901
+ if (discovered.tests.length > 0) {
1902
+ console.log(` Tests: ${discovered.tests.length}`);
1903
+ }
1904
+ console.log("");
1905
+ let failed = false;
1906
+ for (const pipeline of discovered.pipelines) {
1907
+ try {
1908
+ await runPipelineCommand(pipeline, runOpts);
1909
+ } catch (error) {
1910
+ console.error(`
1911
+ \u274C Pipeline failed: ${path4__namespace.default.basename(pipeline)}`);
1912
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1913
+ `);
1914
+ failed = true;
1915
+ }
1916
+ }
1917
+ for (const workflow of discovered.workflows) {
1918
+ try {
1919
+ await runWorkflowCommand(workflow, runOpts);
1920
+ } catch (error) {
1921
+ console.error(`
1922
+ \u274C Workflow failed: ${path4__namespace.default.basename(workflow)}`);
1923
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1924
+ `);
1925
+ failed = true;
1926
+ }
1927
+ }
1928
+ for (const test of discovered.tests) {
1929
+ try {
1930
+ await runTestCommand(test, {
1931
+ headed: options.visible,
1932
+ browser,
1933
+ noServer: !options.server,
1934
+ interactive: options.interactive,
1935
+ debug: options.debug,
1936
+ sessionId: options.sessionId,
1937
+ trackDir: options.trackDir
1938
+ });
1939
+ } catch (error) {
1940
+ console.error(`
1941
+ \u274C Test failed: ${path4__namespace.default.basename(test)}`);
1942
+ console.error(` ${error instanceof Error ? error.message : String(error)}
1868
1943
  `);
1869
1944
  failed = true;
1870
1945
  }