diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ed015a..583269d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: matrix: os: - ubuntu-latest - # - windows-latest + - windows-latest - macos-latest runtime: - name: deno diff --git a/@mizu/http/event/mod_test.html b/@mizu/http/event/mod_test.html index fd8638f..b8e7ba4 100644 --- a/@mizu/http/event/mod_test.html +++ b/@mizu/http/event/mod_test.html @@ -13,10 +13,11 @@ @@ -33,13 +34,14 @@ @@ -57,9 +59,10 @@ @@ -77,13 +80,15 @@ diff --git a/@mizu/internal/testing/test.ts b/@mizu/internal/testing/test.ts index 090cdea..cce4ec9 100644 --- a/@mizu/internal/testing/test.ts +++ b/@mizu/internal/testing/test.ts @@ -46,7 +46,7 @@ export function test(path: string | ImportMeta, runner = _test) { let url = arguments[0] if (!URL.canParse(url)) { const { address: hostname, port } = testing.http.server?.address() as { address: string; port: number } - url = `http://${hostname.replace("0.0.0.0", "localhost")}:${port}${arguments[0]}` + url = `http://${hostname.replace("0.0.0.0", "127.0.0.1")}:${port}${arguments[0]}` } return fetch(url, ...Array.from(arguments).slice(1)) }, @@ -80,7 +80,7 @@ export function test(path: string | ImportMeta, runner = _test) { } finally { await testing.http.server?.close() } - }, { permissions: { net: ["localhost", "0.0.0.0"] } }) + }, { permissions: { net: ["localhost", "0.0.0.0", "127.0.0.1"] } }) }) } @@ -288,7 +288,7 @@ async function http(operation: HTMLElement, testing: Testing) { // Start server and update global location testing.http.server.listen(0, "0.0.0.0", () => { const { address: hostname, port } = testing.http.server?.address() as { address: string; port: number } - globalThis.location = Object.assign(new URL(`http://${hostname.replace("0.0.0.0", "localhost")}:${port}`), { + globalThis.location = Object.assign(new URL(`http://${hostname.replace("0.0.0.0", "127.0.0.1")}:${port}`), { ancestorOrigins: testing.renderer.window.location.ancestorOrigins, assign: testing.renderer.window.location.assign, replace: testing.renderer.window.location.replace, diff --git a/@mizu/render/server/generate_test.ts b/@mizu/render/server/generate_test.ts index 6a9e641..31b8185 100644 --- a/@mizu/render/server/generate_test.ts +++ b/@mizu/render/server/generate_test.ts @@ -2,7 +2,8 @@ import type { testing } from "@libs/testing" import { expect, fn, test } from "@libs/testing" import { join, resolve } from "@std/path" import { Server } from "./server.ts" -const output = resolve("/fake/path") +const root = resolve(import.meta.dirname!, "/") +const output = resolve(root, "/fake/path") const encoder = new TextEncoder() const fs = { stat: fn(), mkdir: fn(), rm: fn(), read: fn(), readdir: fn(() => []), write: fn() } as testing @@ -94,8 +95,8 @@ test("`Server.generate()` can retrieve content from local files", async () => { { directory: "/", render: { select: "p", context: { foo: "baz" } } }, ], ]) - expect(write).toHaveBeenCalledWith(resolve("/fake/path/a/b/foo.html"), encoder.encode(`

bar

`)) - expect(write).toHaveBeenCalledWith(resolve("/fake/path/bar.html"), encoder.encode(`

baz

`)) + expect(write).toHaveBeenCalledWith(resolve(root, "/fake/path/a/b/foo.html"), encoder.encode(`

bar

`)) + expect(write).toHaveBeenCalledWith(resolve(root, "/fake/path/bar.html"), encoder.encode(`

baz

`)) } }, { permissions: { read: true } }) diff --git a/deno.jsonc b/deno.jsonc index 5b1a7c5..c872c8f 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -117,9 +117,17 @@ "dependencies": ["build:www"] }, "reinstall": { + "description": "Alias for task reinstall:deno", + "command": "sleep 0" + }, + "reinstall:deno": { "description": "Clean and reinstall dependencies (deno)", "command": "rm -rf node_modules deno.lock package.json package-lock.json && deno install" }, + "reinstall:node": { + "description": "Clean and reinstall dependencies (node)", + "command": "rm -rf node_modules package-lock.json && npm install" + }, // Miscellaneous tasks "repo:fill-scopes": { "description": "Fill scopes in repository files",