From c32a222ea90824a4edf55dcb6c644445c1f2baeb Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:10:00 -0500 Subject: [PATCH 1/4] fix: windows ci pass 2 --- .github/workflows/ci.yml | 2 +- @mizu/internal/testing/test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f33e812..bae2b69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: matrix: os: - ubuntu-latest - # - windows-latest + - windows-latest - macos-latest runtime: - name: deno diff --git a/@mizu/internal/testing/test.ts b/@mizu/internal/testing/test.ts index 090cdea..3043198 100644 --- a/@mizu/internal/testing/test.ts +++ b/@mizu/internal/testing/test.ts @@ -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"] } }) }) } From 7d391da1dc2209c3358ea90fe00a67c32fb081a8 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:28:07 -0500 Subject: [PATCH 2/4] fix deno windows i think --- @mizu/http/event/mod_test.html | 47 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 21 deletions(-) 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 @@ From 9cfade310ad4d04d1337812c5749c06ab4c3f1b6 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:45:14 -0500 Subject: [PATCH 3/4] maybe ipv4/ipv6 --- @mizu/internal/testing/test.ts | 4 ++-- deno.jsonc | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/@mizu/internal/testing/test.ts b/@mizu/internal/testing/test.ts index 3043198..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)) }, @@ -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/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", From ca73aa8149d3f36edef0c4e4692ba2e1070c2138 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:59:41 -0500 Subject: [PATCH 4/4] resolve drive letter --- @mizu/render/server/generate_test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 } })