Skip to content

Commit 384a425

Browse files
test: remove verifyBuildScript logic from c3 e2e tests (#9504)
This was incorrect for Workers+Assets projects (since it was using `wrangler pages dev` and is redundant because it is testing the same functionality as `verifyPreviewScript`.
1 parent 6bc0a2f commit 384a425

File tree

2 files changed

+1
-98
lines changed

2 files changed

+1
-98
lines changed

packages/create-cloudflare/e2e-tests/frameworks.test.ts

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
TEST_TIMEOUT,
3434
testDeploymentCommitMessage,
3535
testGitCommitMessage,
36-
waitForExit,
3736
} from "./helpers";
3837
import type { TemplateConfig } from "../src/templates";
3938
import type { RunnerConfig } from "./helpers";
@@ -45,16 +44,10 @@ type FrameworkTestConfig = RunnerConfig & {
4544
nodeCompat: boolean;
4645
unsupportedPms?: string[];
4746
unsupportedOSs?: string[];
48-
verifyBuild?: {
49-
outputDir: string;
50-
script: string;
51-
route: string;
52-
expectedText: string;
53-
};
5447
flags?: string[];
5548
};
5649

57-
const { name: pm, npx } = detectPackageManager();
50+
const { name: pm } = detectPackageManager();
5851

5952
function getFrameworkTests(opts: {
6053
experimental: boolean;
@@ -180,7 +173,6 @@ describe.concurrent(
180173
);
181174

182175
await verifyTypes(testConfig, frameworkConfig, project.path);
183-
await verifyBuildScript(testConfig, project.path, logStream);
184176
} catch (e) {
185177
console.error("ERROR", e);
186178
expect.fail(
@@ -404,59 +396,6 @@ const verifyTypes = async (
404396
}
405397
};
406398

407-
const verifyBuildScript = async (
408-
{ verifyBuild }: FrameworkTestConfig,
409-
projectPath: string,
410-
logStream: Writable,
411-
) => {
412-
if (!verifyBuild) {
413-
return;
414-
}
415-
416-
const { outputDir, script, route, expectedText } = verifyBuild;
417-
418-
// Run the build scripts
419-
const buildProc = spawnWithLogging(
420-
[pm, "run", script],
421-
{
422-
cwd: projectPath,
423-
env: {
424-
NODE_ENV: "production",
425-
},
426-
},
427-
logStream,
428-
);
429-
await waitForExit(buildProc);
430-
431-
// Run wrangler dev on a random port to avoid colliding with other tests
432-
const TEST_PORT = Math.ceil(Math.random() * 1000) + 20000;
433-
434-
const devProc = spawnWithLogging(
435-
[npx, "wrangler", "pages", "dev", outputDir, "--port", `${TEST_PORT}`],
436-
{
437-
cwd: projectPath,
438-
},
439-
logStream,
440-
);
441-
442-
// Wait a few seconds for dev server to spin up
443-
await sleep(7000);
444-
445-
// Make a request to the specified test route
446-
const res = await fetch(`http://127.0.0.1:${TEST_PORT}${route}`);
447-
const body = await res.text();
448-
449-
// Kill the process gracefully so ports can be cleaned up
450-
await kill(devProc);
451-
452-
// Wait for a second to allow process to exit cleanly. Otherwise, the port might
453-
// end up camped and cause future runs to fail
454-
await sleep(1000);
455-
456-
// Verify expectation after killing the process so that it exits cleanly in case of failure
457-
expect(body).toContain(expectedText);
458-
};
459-
460399
function shouldRunTest(frameworkId: string, testConfig: FrameworkTestConfig) {
461400
const quarantineModeMatch =
462401
isQuarantineMode() == (testConfig.quarantine ?? false);

packages/create-cloudflare/e2e-tests/frameworks/framework-test-config.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ export default function getFrameworkTestConfig(pm: string) {
3131
route: "/test",
3232
expectedText: "C3_TEST",
3333
},
34-
verifyBuild: {
35-
outputDir: "./dist",
36-
script: "build",
37-
route: "/test",
38-
expectedText: "C3_TEST",
39-
},
4034
nodeCompat: true,
4135
flags: [
4236
"--skip-houston",
@@ -60,12 +54,6 @@ export default function getFrameworkTestConfig(pm: string) {
6054
route: "/test",
6155
expectedText: "C3_TEST",
6256
},
63-
verifyBuild: {
64-
outputDir: "./dist",
65-
script: "build",
66-
route: "/test",
67-
expectedText: "C3_TEST",
68-
},
6957
nodeCompat: true,
7058
flags: [
7159
"--skip-houston",
@@ -143,12 +131,6 @@ export default function getFrameworkTestConfig(pm: string) {
143131
route: "/api/v1/test",
144132
expectedText: "C3_TEST",
145133
},
146-
verifyBuild: {
147-
outputDir: "./dist/analog/public",
148-
script: "build",
149-
route: "/api/v1/test",
150-
expectedText: "C3_TEST",
151-
},
152134
nodeCompat: false,
153135
flags: ["--skipTailwind"],
154136
},
@@ -325,12 +307,6 @@ export default function getFrameworkTestConfig(pm: string) {
325307
route: "/test",
326308
expectedText: "C3_TEST",
327309
},
328-
verifyBuild: {
329-
outputDir: "./build/client",
330-
script: "build",
331-
route: "/test",
332-
expectedText: "C3_TEST",
333-
},
334310
nodeCompat: false,
335311
flags: ["--typescript", "--no-install", "--no-git-init"],
336312
},
@@ -412,12 +388,6 @@ export default function getFrameworkTestConfig(pm: string) {
412388
route: "/test",
413389
expectedText: "C3_TEST",
414390
},
415-
verifyBuild: {
416-
outputDir: "./dist",
417-
script: "build",
418-
route: "/test",
419-
expectedText: "C3_TEST",
420-
},
421391
},
422392
"nuxt:workers": {
423393
promptHandlers: [
@@ -534,12 +504,6 @@ export default function getFrameworkTestConfig(pm: string) {
534504
route: "/test",
535505
expectedText: "C3_TEST",
536506
},
537-
verifyBuild: {
538-
outputDir: ".svelte-kit/cloudflare",
539-
script: "build",
540-
route: "/test",
541-
expectedText: "C3_TEST",
542-
},
543507
nodeCompat: false,
544508
},
545509
"svelte:workers": {

0 commit comments

Comments
 (0)