Skip to content

Commit 409825b

Browse files
authored
Small testing fixups (#8654)
* Add vitest config to d1 * fix vi.waitFor()
1 parent e099c8b commit 409825b

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineProject, mergeConfig } from "vitest/config";
2+
import configShared from "../../vitest.shared";
3+
4+
export default mergeConfig(
5+
configShared,
6+
defineProject({
7+
test: {},
8+
})
9+
);

fixtures/workers-with-assets-and-service-bindings/tests/index.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
5555
it("should return Asset Worker response for routes that serve static content", async ({
5656
expect,
5757
}) => {
58-
vi.waitFor(async () => {
58+
await vi.waitFor(async () => {
5959
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
6060
let text = await response.text();
6161
expect(response.status).toBe(200);
@@ -75,7 +75,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
7575
it("should return User Worker response for routes that don't serve static content", async ({
7676
expect,
7777
}) => {
78-
vi.waitFor(async () => {
78+
await vi.waitFor(async () => {
7979
let response = await fetch(
8080
`http://${ipWorkerA}:${portWorkerA}/no-assets-at-this-path`
8181
);
@@ -90,7 +90,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
9090
it("should return User Worker response for named functions", async ({
9191
expect,
9292
}) => {
93-
vi.waitFor(async () => {
93+
await vi.waitFor(async () => {
9494
// fetch URL is irrelevant here. workerA will internally call
9595
// the appropriate fns on the service binding instead
9696
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -106,7 +106,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
106106
});
107107

108108
it("should return cron trigger responses", async ({ expect }) => {
109-
vi.waitFor(async () => {
109+
await vi.waitFor(async () => {
110110
// fetch URL is irrelevant here. workerA will internally call
111111
// env.DEFAULT_EXPORT.scheduled({cron: "* * * * *"}) instead
112112
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -126,7 +126,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
126126
});
127127

128128
it("should support promise pipelining", async ({ expect }) => {
129-
vi.waitFor(async () => {
129+
await vi.waitFor(async () => {
130130
// fetch URL is irrelevant here. workerA will internally call
131131
// the appropriate fns on the service binding instead
132132
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -139,7 +139,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
139139
});
140140

141141
it("should support property access", async ({ expect }) => {
142-
vi.waitFor(async () => {
142+
await vi.waitFor(async () => {
143143
// fetch URL is irrelevant here. workerA will internally call
144144
// the appropriate fns on the service binding instead
145145
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -162,7 +162,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
162162
it("should return Asset Worker response for fetch requests for routes that serve static content", async ({
163163
expect,
164164
}) => {
165-
vi.waitFor(async () => {
165+
await vi.waitFor(async () => {
166166
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
167167
let text = await response.text();
168168
expect(response.status).toBe(200);
@@ -182,7 +182,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
182182
it("should return User Worker response for routes that don't serve static content", async ({
183183
expect,
184184
}) => {
185-
vi.waitFor(async () => {
185+
await vi.waitFor(async () => {
186186
let response = await fetch(
187187
`http://${ipWorkerA}:${portWorkerA}/no-assets-at-this-path`
188188
);
@@ -197,7 +197,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
197197
it("should return User Worker response for named functions", async ({
198198
expect,
199199
}) => {
200-
vi.waitFor(async () => {
200+
await vi.waitFor(async () => {
201201
// fetch URL is irrelevant here. workerA will internally call
202202
// the appropriate fns on the service binding instead
203203
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -213,7 +213,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
213213
});
214214

215215
it("should return cron trigger responses", async ({ expect }) => {
216-
vi.waitFor(async () => {
216+
await vi.waitFor(async () => {
217217
// fetch URL is irrelevant here. workerA will internally call
218218
// env.DEFAULT_ENTRYPOINT.scheduled({cron: "* * * * *"}) instead
219219
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -232,7 +232,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
232232
});
233233

234234
it("should support promise pipelining", async ({ expect }) => {
235-
vi.waitFor(async () => {
235+
await vi.waitFor(async () => {
236236
// fetch URL is irrelevant here. workerA will internally call
237237
// the appropriate fns on the service binding instead
238238
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -248,7 +248,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
248248
});
249249

250250
it("should support property access", async ({ expect }) => {
251-
vi.waitFor(async () => {
251+
await vi.waitFor(async () => {
252252
// fetch URL is irrelevant here. workerA will internally call
253253
// the appropriate fns on the service binding instead
254254
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -268,7 +268,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
268268
it("should return User Worker response for fetch requests", async ({
269269
expect,
270270
}) => {
271-
vi.waitFor(async () => {
271+
await vi.waitFor(async () => {
272272
// static asset route
273273
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
274274
let text = await response.text();
@@ -300,7 +300,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
300300
it("should return User Worker response for named functions", async ({
301301
expect,
302302
}) => {
303-
vi.waitFor(async () => {
303+
await vi.waitFor(async () => {
304304
// fetch URL is irrelevant here. workerA will internally call
305305
// the appropriate fns on the service binding instead
306306
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -316,7 +316,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
316316
});
317317

318318
it("should support promise pipelining", async ({ expect }) => {
319-
vi.waitFor(async () => {
319+
await vi.waitFor(async () => {
320320
// fetch URL is irrelevant here. workerA will internally call
321321
// the appropriate fns on the service binding instead
322322
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);
@@ -332,7 +332,7 @@ describe("[Workers + Assets] Service bindings to Worker with assets", () => {
332332
});
333333

334334
it("should support property access", async ({ expect }) => {
335-
vi.waitFor(async () => {
335+
await vi.waitFor(async () => {
336336
// fetch URL is irrelevant here. workerA will internally call
337337
// the appropriate fns on the service binding instead
338338
let response = await fetch(`http://${ipWorkerA}:${portWorkerA}`);

0 commit comments

Comments
 (0)