Skip to content

Commit af4e844

Browse files
committed
Deflake test
1 parent fdbccef commit af4e844

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/js/web/fetch/fetch.tls.test.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import { tls as cert1, expiredTls as cert2 } from "harness";
1414
const CERT_LOCALHOST_IP = { ...cert1 };
1515
const CERT_EXPIRED = { ...cert2 };
1616

17+
// Note: Do not use bun.sh as the example domain
18+
// Cloudflare sometimes blocks automated requests to it.
19+
// so it will cause flaky tests.
1720
async function createServer(cert: TLSOptions, callback: (port: number) => Promise<any>) {
1821
using server = Bun.serve({
1922
port: 0,
@@ -48,7 +51,7 @@ it("can handle multiple requests with non native checkServerIdentity", async ()
4851
});
4952

5053
it("fetch with valid tls should not throw", async () => {
51-
const promises = [`https://bun.sh`, `https://www.example.com`].map(async url => {
54+
const promises = [`https://example.com`, `https://www.example.com`].map(async url => {
5255
const result = await fetch(url, { keepalive: false }).then((res: Response) => res.blob());
5356
expect(result?.size).toBeGreaterThan(0);
5457
});
@@ -58,7 +61,7 @@ it("fetch with valid tls should not throw", async () => {
5861

5962
it("fetch with valid tls and non-native checkServerIdentity should work", async () => {
6063
let count = 0;
61-
const promises = [`https://bun.sh`, `https://www.example.com`].map(async url => {
64+
const promises = [`https://example.com`, `https://www.example.com`].map(async url => {
6265
await fetch(url, {
6366
keepalive: false,
6467
tls: {
@@ -123,7 +126,7 @@ it("fetch with invalid tls should throw", async () => {
123126

124127
it("fetch with checkServerIdentity failing should throw", async () => {
125128
try {
126-
await fetch(`https://bun.sh`, {
129+
await fetch(`https://example.com`, {
127130
keepalive: false,
128131
tls: {
129132
checkServerIdentity() {

0 commit comments

Comments
 (0)