Fix tests for windows paths (#1153)
parent
613cfad233
commit
b532b9e3f1
|
@ -6,6 +6,7 @@ import { assertEquals } from "@std/assert";
|
||||||
import { dirname, join } from "@std/path";
|
import { dirname, join } from "@std/path";
|
||||||
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
||||||
import { runPlug } from "../plug_run.ts";
|
import { runPlug } from "../plug_run.ts";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
Deno.test("Test plug run", {
|
Deno.test("Test plug run", {
|
||||||
sanitizeResources: false,
|
sanitizeResources: false,
|
||||||
|
@ -13,7 +14,7 @@ Deno.test("Test plug run", {
|
||||||
}, async () => {
|
}, async () => {
|
||||||
const assetBundle = new AssetBundle(assets);
|
const assetBundle = new AssetBundle(assets);
|
||||||
|
|
||||||
const testFolder = dirname(new URL(import.meta.url).pathname);
|
const testFolder = dirname(fileURLToPath(new URL(import.meta.url)));
|
||||||
const testSpaceFolder = join(testFolder, "test_space");
|
const testSpaceFolder = join(testFolder, "test_space");
|
||||||
|
|
||||||
const plugFolder = join(testSpaceFolder, "_plug");
|
const plugFolder = join(testSpaceFolder, "_plug");
|
||||||
|
@ -27,7 +28,7 @@ Deno.test("Test plug run", {
|
||||||
join(testFolder, "test_plug_run.plug.yaml"),
|
join(testFolder, "test_plug_run.plug.yaml"),
|
||||||
plugFolder,
|
plugFolder,
|
||||||
{
|
{
|
||||||
configPath: new URL("../../deno.json", import.meta.url).pathname,
|
configPath: fileURLToPath(new URL("../../deno.json", import.meta.url)),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { assertEquals } from "@std/assert";
|
||||||
import { compileManifest } from "../compile.ts";
|
import { compileManifest } from "../compile.ts";
|
||||||
import * as esbuild from "esbuild";
|
import * as esbuild from "esbuild";
|
||||||
import type { SysCallMapping } from "../../lib/plugos/system.ts";
|
import type { SysCallMapping } from "../../lib/plugos/system.ts";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
Deno.test("Run a deno sandbox", {
|
Deno.test("Run a deno sandbox", {
|
||||||
sanitizeResources: false,
|
sanitizeResources: false,
|
||||||
|
@ -32,10 +33,10 @@ Deno.test("Run a deno sandbox", {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
|
|
||||||
const workerPath = await compileManifest(
|
const workerPath = await compileManifest(
|
||||||
new URL("test_runtime.plug.yaml", import.meta.url).pathname,
|
fileURLToPath(new URL("test_runtime.plug.yaml", import.meta.url)),
|
||||||
tempDir,
|
tempDir,
|
||||||
{
|
{
|
||||||
configPath: new URL("../../deno.json", import.meta.url).pathname,
|
configPath: fileURLToPath(new URL("../../deno.json", import.meta.url)),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@ import { luaBuildStandardEnv } from "$common/space_lua/stdlib.ts";
|
||||||
import { LuaEnv, LuaStackFrame } from "$common/space_lua/runtime.ts";
|
import { LuaEnv, LuaStackFrame } from "$common/space_lua/runtime.ts";
|
||||||
import { evalStatement } from "$common/space_lua/eval.ts";
|
import { evalStatement } from "$common/space_lua/eval.ts";
|
||||||
import { assert } from "@std/assert/assert";
|
import { assert } from "@std/assert/assert";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
Deno.test("Lua language tests", async () => {
|
Deno.test("Lua language tests", async () => {
|
||||||
// Read the Lua file
|
// Read the Lua file
|
||||||
const luaFile = await Deno.readTextFile(
|
const luaFile = await Deno.readTextFile(
|
||||||
new URL("./language_test.lua", import.meta.url).pathname,
|
fileURLToPath(new URL("./language_test.lua", import.meta.url)),
|
||||||
);
|
);
|
||||||
const chunk = parse(luaFile, {});
|
const chunk = parse(luaFile, {});
|
||||||
const env = new LuaEnv(luaBuildStandardEnv());
|
const env = new LuaEnv(luaBuildStandardEnv());
|
||||||
|
|
|
@ -2,10 +2,11 @@ import type { FileMeta } from "../../../plug-api/types.ts";
|
||||||
import { assert } from "@std/assert";
|
import { assert } from "@std/assert";
|
||||||
import fileSystemSyscalls from "./fs.deno.ts";
|
import fileSystemSyscalls from "./fs.deno.ts";
|
||||||
import { dirname, resolve } from "@std/path";
|
import { dirname, resolve } from "@std/path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
Deno.test("Test FS operations", async () => {
|
Deno.test("Test FS operations", async () => {
|
||||||
const thisFolder = resolve(
|
const thisFolder = resolve(
|
||||||
dirname(new URL(import.meta.url).pathname),
|
dirname(fileURLToPath(new URL(import.meta.url))),
|
||||||
);
|
);
|
||||||
const syscalls = fileSystemSyscalls(thisFolder);
|
const syscalls = fileSystemSyscalls(thisFolder);
|
||||||
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
|
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { createSandbox } from "../../lib/plugos/sandboxes/deno_worker_sandbox.ts
|
||||||
import { renderMarkdownToHtml } from "./markdown_render.ts";
|
import { renderMarkdownToHtml } from "./markdown_render.ts";
|
||||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||||
import { assertEquals } from "@std/assert";
|
import { assertEquals } from "@std/assert";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
Deno.test("Markdown render", async () => {
|
Deno.test("Markdown render", async () => {
|
||||||
const system = new System<any>("server");
|
const system = new System<any>("server");
|
||||||
|
@ -21,7 +22,7 @@ Deno.test("Markdown render", async () => {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const testFile = Deno.readTextFileSync(
|
const testFile = Deno.readTextFileSync(
|
||||||
new URL("test/example.md", import.meta.url).pathname,
|
fileURLToPath(new URL("test/example.md", import.meta.url)),
|
||||||
);
|
);
|
||||||
const tree = parse(extendedMarkdownLanguage, testFile);
|
const tree = parse(extendedMarkdownLanguage, testFile);
|
||||||
renderMarkdownToHtml(tree, {
|
renderMarkdownToHtml(tree, {
|
||||||
|
|
Loading…
Reference in New Issue