summaryrefslogtreecommitdiff
path: root/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts')
-rw-r--r--node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts
new file mode 100644
index 0000000..974364b
--- /dev/null
+++ b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts
@@ -0,0 +1,25 @@
+import { unstable_dev } from "wrangler";
+import type { UnstableDevWorker } from "wrangler";
+import { describe, expect, it, beforeAll, afterAll } from "vitest";
+
+describe("Worker", () => {
+ let worker: UnstableDevWorker;
+
+ beforeAll(async () => {
+ worker = await unstable_dev("src/index.ts", {
+ experimental: { disableExperimentalWarning: true },
+ });
+ });
+
+ afterAll(async () => {
+ await worker.stop();
+ });
+
+ it("should return Hello World", async () => {
+ const resp = await worker.fetch();
+ if (resp) {
+ const text = await resp.text();
+ expect(text).toMatchInlineSnapshot(`"Hello World!"`);
+ }
+ });
+});