Unverified Commit 31d077e4 authored by Hong Minhee's avatar Hong Minhee
Browse files

Pass the whole unit tests on Node.js

parent 38cfbc3e
Loading
Loading
Loading
Loading
+794 −66

File changed.

Preview size limit exceeded, changes collapsed.

+20 −1
Original line number Diff line number Diff line
@@ -19,6 +19,11 @@ export async function* generateInspector(
          inspect: typeof Deno.inspect,
          options: Deno.InspectOptions,
        ): string => "URL " + inspect(this.id!.href, options),
        [Symbol.for("nodejs.util.inspect.custom")]: (
          _depth: number,
          options: unknown,
          inspect: (value: unknown, options: unknown) => string,
        ): string => "URL " + inspect(this.id!.href, options),
      };
    }
    `;
@@ -37,7 +42,12 @@ export async function* generateInspector(
            [Symbol.for("Deno.customInspect")]: (
              inspect: typeof Deno.inspect,
              options: Deno.InspectOptions,
            ): string => "URL " + inspect(v.href, options)
            ): string => "URL " + inspect(v.href, options),
            [Symbol.for("nodejs.util.inspect.custom")]: (
              _depth: number,
              options: unknown,
              inspect: (value: unknown, options: unknown) => string,
            ): string => "URL " + inspect(v.href, options),
          }
        : v);
      `;
@@ -70,5 +80,14 @@ export async function* generateInspector(
    const proxy = this._getCustomInspectProxy();
    return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
  }

  [Symbol.for("nodejs.util.inspect.custom")](
    _depth: number,
    options: unknown,
    inspect: (value: unknown, options: unknown) => string,
  ): string {
    const proxy = this._getCustomInspectProxy();
    return ${JSON.stringify(type.name + " ")} + inspect(proxy, options);
  }
  `;
}
+8 −2
Original line number Diff line number Diff line
@@ -174,8 +174,14 @@ export class SchemaError extends Error {

async function loadSchemaValidator(): Promise<Validator> {
  const thisFile = new URL(import.meta.url);
  const response = await fetch(url.join(url.dirname(thisFile), "schema.yaml"));
  const content = await response.text();
  const schemaFile = url.join(url.dirname(thisFile), "schema.yaml");
  let content: string;
  if (schemaFile.protocol !== "file:") {
    const response = await fetch(schemaFile);
    content = await response.text();
  } else {
    content = await Deno.readTextFile(schemaFile);
  }
  const schemaObject = parse(content);
  return new Validator(schemaObject as JsonSchema);
}
+3 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
  },
  "imports": {
    "@cfworker/json-schema": "npm:@cfworker/json-schema@^1.12.8",
    "@david/which-runtime": "jsr:@david/which-runtime@^0.2.0",
    "@deno/dnt": "jsr:@deno/dnt@^0.41.1",
    "@fedify/fedify": "./mod.ts",
    "@fedify/fedify/federation": "./federation/mod.ts",
@@ -62,7 +63,8 @@
    "test": "deno task codegen && deno task test-without-codegen",
    "coverage": "rm -rf coverage/ && deno task test --coverage && deno coverage --html coverage",
    "apidoc": "deno task codegen && deno doc --html --name=Fedify --output=apidoc/ mod.ts",
    "publish": "deno task codegen && deno publish"
    "publish": "deno task codegen && deno publish",
    "dnt": "deno task codegen && deno run -A dnt.ts"
  },
  "unstable": [
    "kv"
+5 −0
Original line number Diff line number Diff line
@@ -76,6 +76,11 @@ await build({
      "npm/esm/testing/fixtures",
      { overwrite: true },
    );
    for await (const entry of Deno.readDir("vocab")) {
      if (!entry.isFile || !entry.name.endsWith(".yaml")) continue;
      await Deno.copyFile(`vocab/${entry.name}`, `npm/esm/vocab/${entry.name}`);
    }
    await Deno.copyFile("codegen/schema.yaml", "npm/esm/codegen/schema.yaml");
    await Deno.copyFile("CHANGES.md", "npm/CHANGES.md");
    await Deno.copyFile("LICENSE", "npm/LICENSE");
    await Deno.copyFile("logo.svg", "npm/logo.svg");
Loading