diff --git a/eslint.config.js b/eslint.config.js index e55c245e5..489d3a081 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -18,7 +18,7 @@ export default [ "reports/*", "coverage/*", "www/**", - "packages/cli/test/cases/build.config.typescript/tsconfig.json", + "packages/cli/test/cases/serve.config.typescript/tsconfig.json", ], }, { diff --git a/package.json b/package.json index 45c2deb1c..aa71ab059 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "eslint-config-prettier": "^10.0.1", "eslint-plugin-import": "^2.32.0", "eslint-plugin-no-only-tests": "^2.6.0", - "gallinago": "^0.10.1", + "gallinago": "^0.11.0", "glob": "^7.1.7", "glob-promise": "^3.4.0", "globals": "^15.10.0", diff --git a/packages/cli/test/cases/develop.config.active-content/develop.config.active-content.spec.js b/packages/cli/test/cases/develop.config.active-content/develop.config.active-content.spec.js index ed65bf1ac..e28222062 100644 --- a/packages/cli/test/cases/develop.config.active-content/develop.config.active-content.spec.js +++ b/packages/cli/test/cases/develop.config.active-content/develop.config.active-content.spec.js @@ -57,12 +57,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.config.base-path/develop.config.base-path.spec.js b/packages/cli/test/cases/develop.config.base-path/develop.config.base-path.spec.js index 8179d4149..2e331ed9a 100644 --- a/packages/cli/test/cases/develop.config.base-path/develop.config.base-path.spec.js +++ b/packages/cli/test/cases/develop.config.base-path/develop.config.base-path.spec.js @@ -61,12 +61,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.config.polyfills-import-attributes/develop.config.polyfills-import-attributes.spec.js b/packages/cli/test/cases/develop.config.polyfills-import-attributes/develop.config.polyfills-import-attributes.spec.js index af737fdbd..a8d55a353 100644 --- a/packages/cli/test/cases/develop.config.polyfills-import-attributes/develop.config.polyfills-import-attributes.spec.js +++ b/packages/cli/test/cases/develop.config.polyfills-import-attributes/develop.config.polyfills-import-attributes.spec.js @@ -51,12 +51,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.config.polyfills-import-maps/develop.config.polyfills-import-maps.spec.js b/packages/cli/test/cases/develop.config.polyfills-import-maps/develop.config.polyfills-import-maps.spec.js index 78979cf18..c0976a2ee 100644 --- a/packages/cli/test/cases/develop.config.polyfills-import-maps/develop.config.polyfills-import-maps.spec.js +++ b/packages/cli/test/cases/develop.config.polyfills-import-maps/develop.config.polyfills-import-maps.spec.js @@ -50,12 +50,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.default.hud-disabled/develop.default.hud-disabled.spec.js b/packages/cli/test/cases/develop.default.hud-disabled/develop.default.hud-disabled.spec.js index a352c24c8..ed7baa0d3 100644 --- a/packages/cli/test/cases/develop.default.hud-disabled/develop.default.hud-disabled.spec.js +++ b/packages/cli/test/cases/develop.default.hud-disabled/develop.default.hud-disabled.spec.js @@ -44,12 +44,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.default.hud/develop.default.hud.spec.js b/packages/cli/test/cases/develop.default.hud/develop.default.hud.spec.js index d0ce9401f..ed4199285 100644 --- a/packages/cli/test/cases/develop.default.hud/develop.default.hud.spec.js +++ b/packages/cli/test/cases/develop.default.hud/develop.default.hud.spec.js @@ -44,12 +44,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.default/develop.default.spec.js b/packages/cli/test/cases/develop.default/develop.default.spec.js index 16c17ad88..6487752d9 100644 --- a/packages/cli/test/cases/develop.default/develop.default.spec.js +++ b/packages/cli/test/cases/develop.default/develop.default.spec.js @@ -76,12 +76,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.plugins.context/develop.plugins.context.spec.js b/packages/cli/test/cases/develop.plugins.context/develop.plugins.context.spec.js index ee308832e..af989799f 100644 --- a/packages/cli/test/cases/develop.plugins.context/develop.plugins.context.spec.js +++ b/packages/cli/test/cases/develop.plugins.context/develop.plugins.context.spec.js @@ -50,12 +50,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.spa/develop.spa.spec.js b/packages/cli/test/cases/develop.spa/develop.spa.spec.js index 2d565c50d..3a4878356 100644 --- a/packages/cli/test/cases/develop.spa/develop.spa.spec.js +++ b/packages/cli/test/cases/develop.spa/develop.spa.spec.js @@ -55,12 +55,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js b/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js index 9a970d312..488cd4fb7 100644 --- a/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js +++ b/packages/cli/test/cases/develop.ssr/develop.ssr.spec.js @@ -52,12 +52,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes("Started local development server at http://localhost:1984")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.typescript.default/develop.typescript.default.spec.js b/packages/cli/test/cases/develop.typescript.default/develop.typescript.default.spec.js index 1fe4f1f62..0c6830ef4 100644 --- a/packages/cli/test/cases/develop.typescript.default/develop.typescript.default.spec.js +++ b/packages/cli/test/cases/develop.typescript.default/develop.typescript.default.spec.js @@ -42,12 +42,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/develop.typescript.ssr/develop.typescript.ssr.spec.js b/packages/cli/test/cases/develop.typescript.ssr/develop.typescript.ssr.spec.js index 6e480676c..3b2c123f6 100644 --- a/packages/cli/test/cases/develop.typescript.ssr/develop.typescript.ssr.spec.js +++ b/packages/cli/test/cases/develop.typescript.ssr/develop.typescript.ssr.spec.js @@ -49,12 +49,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes("Started local development server at http://localhost:1984")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/loaders-develop.ssr-import-attributes/loaders-develop.ssr-import-attributes.spec.js b/packages/cli/test/cases/loaders-develop.ssr-import-attributes/loaders-develop.ssr-import-attributes.spec.js index 051e9a58a..0906f2d58 100644 --- a/packages/cli/test/cases/loaders-develop.ssr-import-attributes/loaders-develop.ssr-import-attributes.spec.js +++ b/packages/cli/test/cases/loaders-develop.ssr-import-attributes/loaders-develop.ssr-import-attributes.spec.js @@ -50,12 +50,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes("Started local development server at http://localhost:1984")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/loaders-serve.config.polyfill-import-attributes/loaders-serve.config.polyfills-import-attributes.spec.js b/packages/cli/test/cases/loaders-serve.config.polyfill-import-attributes/loaders-serve.config.polyfills-import-attributes.spec.js index 7ad1cf309..7ab62027f 100644 --- a/packages/cli/test/cases/loaders-serve.config.polyfill-import-attributes/loaders-serve.config.polyfills-import-attributes.spec.js +++ b/packages/cli/test/cases/loaders-serve.config.polyfill-import-attributes/loaders-serve.config.polyfills-import-attributes.spec.js @@ -58,12 +58,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/loaders-serve.default.ssr-import-attributes/loaders-serve.default.ssr-import-attributes.spec.js b/packages/cli/test/cases/loaders-serve.default.ssr-import-attributes/loaders-serve.default.ssr-import-attributes.spec.js index ee4f0ae33..94d49e543 100644 --- a/packages/cli/test/cases/loaders-serve.default.ssr-import-attributes/loaders-serve.default.ssr-import-attributes.spec.js +++ b/packages/cli/test/cases/loaders-serve.default.ssr-import-attributes/loaders-serve.default.ssr-import-attributes.spec.js @@ -54,12 +54,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.config.base-path/serve.config.base-path.spec.js b/packages/cli/test/cases/serve.config.base-path/serve.config.base-path.spec.js index db7c407cf..62658611a 100644 --- a/packages/cli/test/cases/serve.config.base-path/serve.config.base-path.spec.js +++ b/packages/cli/test/cases/serve.config.base-path/serve.config.base-path.spec.js @@ -69,12 +69,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.config.static-router/serve.config.static-router.spec.js b/packages/cli/test/cases/serve.config.static-router/serve.config.static-router.spec.js index ba2927f30..d3d79b4ab 100644 --- a/packages/cli/test/cases/serve.config.static-router/serve.config.static-router.spec.js +++ b/packages/cli/test/cases/serve.config.static-router/serve.config.static-router.spec.js @@ -49,12 +49,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(async () => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/build.config.typescript/greenwood.config.ts b/packages/cli/test/cases/serve.config.typescript/greenwood.config.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/greenwood.config.ts rename to packages/cli/test/cases/serve.config.typescript/greenwood.config.ts diff --git a/packages/cli/test/cases/build.config.typescript/build.config.typescript.spec.js b/packages/cli/test/cases/serve.config.typescript/serve.config.typescript.spec.js similarity index 92% rename from packages/cli/test/cases/build.config.typescript/build.config.typescript.spec.js rename to packages/cli/test/cases/serve.config.typescript/serve.config.typescript.spec.js index a2abaf4e8..c6f14bf66 100644 --- a/packages/cli/test/cases/build.config.typescript/build.config.typescript.spec.js +++ b/packages/cli/test/cases/serve.config.typescript/serve.config.typescript.spec.js @@ -60,12 +60,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/build.config.typescript/src/components/card/card.ts b/packages/cli/test/cases/serve.config.typescript/src/components/card/card.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/components/card/card.ts rename to packages/cli/test/cases/serve.config.typescript/src/components/card/card.ts diff --git a/packages/cli/test/cases/build.config.typescript/src/components/card/logo.png b/packages/cli/test/cases/serve.config.typescript/src/components/card/logo.png similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/components/card/logo.png rename to packages/cli/test/cases/serve.config.typescript/src/components/card/logo.png diff --git a/packages/cli/test/cases/build.config.typescript/src/components/card/styles.ts b/packages/cli/test/cases/serve.config.typescript/src/components/card/styles.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/components/card/styles.ts rename to packages/cli/test/cases/serve.config.typescript/src/components/card/styles.ts diff --git a/packages/cli/test/cases/build.config.typescript/src/components/greeting/greeting.css b/packages/cli/test/cases/serve.config.typescript/src/components/greeting/greeting.css similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/components/greeting/greeting.css rename to packages/cli/test/cases/serve.config.typescript/src/components/greeting/greeting.css diff --git a/packages/cli/test/cases/build.config.typescript/src/components/greeting/greeting.ts b/packages/cli/test/cases/serve.config.typescript/src/components/greeting/greeting.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/components/greeting/greeting.ts rename to packages/cli/test/cases/serve.config.typescript/src/components/greeting/greeting.ts diff --git a/packages/cli/test/cases/build.config.typescript/src/pages/api/fragment.ts b/packages/cli/test/cases/serve.config.typescript/src/pages/api/fragment.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/pages/api/fragment.ts rename to packages/cli/test/cases/serve.config.typescript/src/pages/api/fragment.ts diff --git a/packages/cli/test/cases/build.config.typescript/src/pages/api/greeting.ts b/packages/cli/test/cases/serve.config.typescript/src/pages/api/greeting.ts similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/pages/api/greeting.ts rename to packages/cli/test/cases/serve.config.typescript/src/pages/api/greeting.ts diff --git a/packages/cli/test/cases/build.config.typescript/src/pages/index.html b/packages/cli/test/cases/serve.config.typescript/src/pages/index.html similarity index 100% rename from packages/cli/test/cases/build.config.typescript/src/pages/index.html rename to packages/cli/test/cases/serve.config.typescript/src/pages/index.html diff --git a/packages/cli/test/cases/build.config.typescript/tsconfig.json b/packages/cli/test/cases/serve.config.typescript/tsconfig.json similarity index 100% rename from packages/cli/test/cases/build.config.typescript/tsconfig.json rename to packages/cli/test/cases/serve.config.typescript/tsconfig.json diff --git a/packages/cli/test/cases/serve.default.api/serve.default.api.spec.js b/packages/cli/test/cases/serve.default.api/serve.default.api.spec.js index dd87c0a12..be48ac92f 100644 --- a/packages/cli/test/cases/serve.default.api/serve.default.api.spec.js +++ b/packages/cli/test/cases/serve.default.api/serve.default.api.spec.js @@ -53,12 +53,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.default.ssr-prerender-api-hybrid/serve.default.ssr-prerender-api-hybrid.spec.js b/packages/cli/test/cases/serve.default.ssr-prerender-api-hybrid/serve.default.ssr-prerender-api-hybrid.spec.js index d3c1ed53a..78321a30c 100644 --- a/packages/cli/test/cases/serve.default.ssr-prerender-api-hybrid/serve.default.ssr-prerender-api-hybrid.spec.js +++ b/packages/cli/test/cases/serve.default.ssr-prerender-api-hybrid/serve.default.ssr-prerender-api-hybrid.spec.js @@ -56,12 +56,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.default.ssr-prerender/serve.default.ssr-prerender.spec.js b/packages/cli/test/cases/serve.default.ssr-prerender/serve.default.ssr-prerender.spec.js index 6fee87d61..44b608ca5 100644 --- a/packages/cli/test/cases/serve.default.ssr-prerender/serve.default.ssr-prerender.spec.js +++ b/packages/cli/test/cases/serve.default.ssr-prerender/serve.default.ssr-prerender.spec.js @@ -54,12 +54,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.default.ssr-static-export/serve.default.ssr-static-export.spec.js b/packages/cli/test/cases/serve.default.ssr-static-export/serve.default.ssr-static-export.spec.js index 8524be75e..c143627d5 100644 --- a/packages/cli/test/cases/serve.default.ssr-static-export/serve.default.ssr-static-export.spec.js +++ b/packages/cli/test/cases/serve.default.ssr-static-export/serve.default.ssr-static-export.spec.js @@ -53,12 +53,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js b/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js index 4616ab35c..faccccca5 100644 --- a/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js +++ b/packages/cli/test/cases/serve.default.ssr/serve.default.ssr.spec.js @@ -64,12 +64,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8181")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.default/serve.default.spec.js b/packages/cli/test/cases/serve.default/serve.default.spec.js index a42ef0bdb..0fd354707 100644 --- a/packages/cli/test/cases/serve.default/serve.default.spec.js +++ b/packages/cli/test/cases/serve.default/serve.default.spec.js @@ -60,12 +60,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes(`Started server at ${hostname}`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.spa/serve.spa.spec.js b/packages/cli/test/cases/serve.spa/serve.spa.spec.js index 2f31b1211..03e72f8f8 100644 --- a/packages/cli/test/cases/serve.spa/serve.spa.spec.js +++ b/packages/cli/test/cases/serve.spa/serve.spa.spec.js @@ -59,12 +59,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.typescript.prerender/serve.typescript.prerender.spec.js b/packages/cli/test/cases/serve.typescript.prerender/serve.typescript.prerender.spec.js index 06013d153..10b331d4c 100644 --- a/packages/cli/test/cases/serve.typescript.prerender/serve.typescript.prerender.spec.js +++ b/packages/cli/test/cases/serve.typescript.prerender/serve.typescript.prerender.spec.js @@ -50,12 +50,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/serve.typescript.ssr/serve.typescript.ssr.spec.js b/packages/cli/test/cases/serve.typescript.ssr/serve.typescript.ssr.spec.js index 3fa129f5e..fedebfd92 100644 --- a/packages/cli/test/cases/serve.typescript.ssr/serve.typescript.ssr.spec.js +++ b/packages/cli/test/cases/serve.typescript.ssr/serve.typescript.ssr.spec.js @@ -56,12 +56,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/cli/test/cases/theme-pack/theme-pack.develop.spec.js b/packages/cli/test/cases/theme-pack/theme-pack.develop.spec.js index 382755095..d4b257d3c 100644 --- a/packages/cli/test/cases/theme-pack/theme-pack.develop.spec.js +++ b/packages/cli/test/cases/theme-pack/theme-pack.develop.spec.js @@ -57,12 +57,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/init/test/cases/develop.default/develop.default.spec.js b/packages/init/test/cases/develop.default/develop.default.spec.js index 8351d1b3e..c357e4f21 100644 --- a/packages/init/test/cases/develop.default/develop.default.spec.js +++ b/packages/init/test/cases/develop.default/develop.default.spec.js @@ -51,12 +51,16 @@ describe("Initialize a new Greenwood project: ", function () { before(async function () { await greenwoodRunner.setup(initOutputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - greenwoodRunner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + greenwoodRunner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-css-modules/test/cases/develop.default/develop.default.spec.js b/packages/plugin-css-modules/test/cases/develop.default/develop.default.spec.js index 39e6d4be7..a4107a67e 100644 --- a/packages/plugin-css-modules/test/cases/develop.default/develop.default.spec.js +++ b/packages/plugin-css-modules/test/cases/develop.default/develop.default.spec.js @@ -65,12 +65,16 @@ describe("Develop Greenwood With: ", function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-graphql/test/cases/develop.default/develop.default.spec.js b/packages/plugin-graphql/test/cases/develop.default/develop.default.spec.js index 6c8b62210..809ddf3f8 100644 --- a/packages/plugin-graphql/test/cases/develop.default/develop.default.spec.js +++ b/packages/plugin-graphql/test/cases/develop.default/develop.default.spec.js @@ -46,12 +46,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-graphql/test/cases/qraphql-server/graphql-server.spec.js b/packages/plugin-graphql/test/cases/qraphql-server/graphql-server.spec.js index b9afe530a..b64249560 100644 --- a/packages/plugin-graphql/test/cases/qraphql-server/graphql-server.spec.js +++ b/packages/plugin-graphql/test/cases/qraphql-server/graphql-server.spec.js @@ -37,17 +37,22 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + // here we are waiting for the _GraphQL_ server to be started + if (message.includes(`GraphQLServer started at http://${hostname}:${port}/`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); // ping the graphql server - describe("Develop command with GraphQL server / playground running", function () { + describe("GraphQL server / playground running", function () { let response = { body: "", code: 0, diff --git a/packages/plugin-import-raw/test/cases/develop.default/develop.default.spec.js b/packages/plugin-import-raw/test/cases/develop.default/develop.default.spec.js index b7914a763..a6e95dba3 100644 --- a/packages/plugin-import-raw/test/cases/develop.default/develop.default.spec.js +++ b/packages/plugin-import-raw/test/cases/develop.default/develop.default.spec.js @@ -49,12 +49,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-import-raw/test/cases/loaders-serve.ssr/loaders-serve.ssr.spec.js b/packages/plugin-import-raw/test/cases/loaders-serve.ssr/loaders-serve.ssr.spec.js index 870ec5153..7b183da0d 100644 --- a/packages/plugin-import-raw/test/cases/loaders-serve.ssr/loaders-serve.ssr.spec.js +++ b/packages/plugin-import-raw/test/cases/loaders-serve.ssr/loaders-serve.ssr.spec.js @@ -58,12 +58,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-markdown/test/cases/develop.plugins.context/develop.plugins.context.spec.js b/packages/plugin-markdown/test/cases/develop.plugins.context/develop.plugins.context.spec.js index e7e892d2a..cd4fd5df7 100644 --- a/packages/plugin-markdown/test/cases/develop.plugins.context/develop.plugins.context.spec.js +++ b/packages/plugin-markdown/test/cases/develop.plugins.context/develop.plugins.context.spec.js @@ -50,12 +50,16 @@ describe("Develop Greenwood With: ", function () { before(async function () { await runner.setup(outputPath); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 5000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes(`Started local development server at http://localhost:1984`)) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-renderer-lit/test/cases/develop.default/develop.default.spec.js b/packages/plugin-renderer-lit/test/cases/develop.default/develop.default.spec.js index 85043cc6b..93d03be23 100644 --- a/packages/plugin-renderer-lit/test/cases/develop.default/develop.default.spec.js +++ b/packages/plugin-renderer-lit/test/cases/develop.default/develop.default.spec.js @@ -164,12 +164,16 @@ describe("Develop Greenwood With: ", function () { ...litSsrDomShimLibs, ]); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "develop"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "develop", { + onStdOut: (message) => { + if (message.includes("Started local development server at http://localhost:1984")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/packages/plugin-renderer-lit/test/cases/serve.default/serve.default.spec.js b/packages/plugin-renderer-lit/test/cases/serve.default/serve.default.spec.js index 1de982d37..cebe361ba 100644 --- a/packages/plugin-renderer-lit/test/cases/serve.default/serve.default.spec.js +++ b/packages/plugin-renderer-lit/test/cases/serve.default/serve.default.spec.js @@ -60,12 +60,16 @@ describe("Serve Greenwood With: ", function () { await runner.setup(outputPath); await runner.runCommand(cliPath, "build"); - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 10000); - - runner.runCommand(cliPath, "serve"); + await new Promise((resolve, reject) => { + runner + .runCommand(cliPath, "serve", { + onStdOut: (message) => { + if (message.includes("Started server at http://localhost:8080")) { + resolve(); + } + }, + }) + .catch(reject); }); }); diff --git a/yarn.lock b/yarn.lock index 5326a6c3f..dbdec53e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10457,10 +10457,10 @@ fuzzy@0.1.3: resolved "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz" integrity sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w== -gallinago@^0.10.1: - version "0.10.1" - resolved "https://registry.yarnpkg.com/gallinago/-/gallinago-0.10.1.tgz#de6f25868231ea951393bb2f344302f27c3f327c" - integrity sha512-HDj+c7XBMcmrV0ESQrc7wa4TQvt/rYwofbXCz9JlEBPfk0xqALww5L4LGj3IspgrRjZTrHSzM+7aL3pNS1FP2Q== +gallinago@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/gallinago/-/gallinago-0.11.0.tgz#45d2662961b0be9d3ea9c3c397d9b233f756b15c" + integrity sha512-mrb2Vl85he1xmsclycN1UcihSSApCrI53ad1V5Wo7aNuz+I0MnrI/u2NbFqv9SfUvZ5ezAp0r3LQnZgY5JeEZA== gauge@^3.0.0: version "3.0.2"