chore: import upstream snapshot with attribution
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { resolve } from "path";
|
||||
import { Agent, fetch } from "undici";
|
||||
import { afterAll, beforeAll, describe, it } from "vitest";
|
||||
import { runWranglerDev } from "../../shared/src/run-wrangler-long-lived";
|
||||
|
||||
describe("'wrangler dev' starts HTTPS server", () => {
|
||||
let ip: string, port: number, stop: (() => Promise<unknown>) | undefined;
|
||||
|
||||
beforeAll(async () => {
|
||||
({ ip, port, stop } = await runWranglerDev(resolve(__dirname, ".."), [
|
||||
"--port=0",
|
||||
"--inspector-port=0",
|
||||
"--local-protocol=https",
|
||||
]));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await stop?.();
|
||||
});
|
||||
|
||||
it("allows access over HTTPS", async ({ expect }) => {
|
||||
const dispatcher = new Agent({
|
||||
// `wrangler dev` will generate a self-signed certificate. By default,
|
||||
// Node will reject these. Therefore, we need to use a custom
|
||||
// dispatcher that accepts "invalid" certificates.
|
||||
connect: { rejectUnauthorized: false },
|
||||
});
|
||||
const response = await fetch(`https://${ip}:${port}/random`, {
|
||||
dispatcher,
|
||||
});
|
||||
expect(response.ok).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user