mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-29 22:14:23 +01:00
WIP restructure
going to try out something different
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="module">
|
||||
import { VFSInterface } from './src/opfs-interface.js';
|
||||
import { VFSInterface } from './packages/web/dist/opfs-interface.js';
|
||||
window.VFSInterface = VFSInterface;
|
||||
</script>
|
||||
</body>
|
||||
@@ -1,6 +1,6 @@
|
||||
// test/opfs.test.js
|
||||
import { afterAll, beforeAll, beforeEach, expect, test } from "vitest";
|
||||
import { setupTestEnvironment, teardownTestEnvironment } from "./helpers";
|
||||
import { setupTestEnvironment, teardownTestEnvironment } from "./helpers.js";
|
||||
|
||||
let testEnv;
|
||||
|
||||
@@ -21,7 +21,7 @@ afterAll(async () => {
|
||||
test("basic read/write functionality", async () => {
|
||||
const { page } = testEnv;
|
||||
const result = await page.evaluate(async () => {
|
||||
const vfs = new window.VFSInterface("/src/opfs-worker.js");
|
||||
const vfs = new window.VFSInterface("./opfs-worker.js");
|
||||
let fd;
|
||||
try {
|
||||
fd = await vfs.open("test.txt", {});
|
||||
@@ -47,7 +47,7 @@ test("basic read/write functionality", async () => {
|
||||
test("larger data read/write", async () => {
|
||||
const { page } = testEnv;
|
||||
const result = await page.evaluate(async () => {
|
||||
const vfs = new window.VFSInterface("/src/opfs-worker.js");
|
||||
const vfs = new window.VFSInterface("./opfs-worker.js");
|
||||
let fd;
|
||||
try {
|
||||
fd = await vfs.open("large.txt", {});
|
||||
@@ -74,7 +74,7 @@ test("larger data read/write", async () => {
|
||||
test("partial reads and writes", async () => {
|
||||
const { page } = testEnv;
|
||||
const result = await page.evaluate(async () => {
|
||||
const vfs = new window.VFSInterface("/src/opfs-worker.js");
|
||||
const vfs = new window.VFSInterface("./opfs-worker.js");
|
||||
let fd;
|
||||
try {
|
||||
fd = await vfs.open("partial.txt", {});
|
||||
@@ -113,7 +113,7 @@ test("partial reads and writes", async () => {
|
||||
test("file size operations", async () => {
|
||||
const { page } = testEnv;
|
||||
const result = await page.evaluate(async () => {
|
||||
const vfs = new window.VFSInterface("/src/opfs-worker.js");
|
||||
const vfs = new window.VFSInterface("./opfs-worker.js");
|
||||
let fd;
|
||||
try {
|
||||
fd = await vfs.open("size.txt", {});
|
||||
@@ -137,4 +137,3 @@ test("file size operations", async () => {
|
||||
expect(Number(result.size1)).toBe(4);
|
||||
expect(Number(result.size2)).toBe(8);
|
||||
});
|
||||
|
||||
29
bindings/wasm/test-web/vite.config.js
Normal file
29
bindings/wasm/test-web/vite.config.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineConfig } from "vite";
|
||||
import wasm from "vite-plugin-wasm";
|
||||
|
||||
export default defineConfig({
|
||||
publicDir: "./html",
|
||||
root: ".",
|
||||
plugins: [wasm()],
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "happy-dom",
|
||||
setupFiles: ["./test/setup.js"],
|
||||
include: ["test/*.test.js"],
|
||||
},
|
||||
server: {
|
||||
headers: {
|
||||
"Cross-Origin-Embedder-Policy": "require-corp",
|
||||
"Cross-Origin-Opener-Policy": "same-origin",
|
||||
"Cross-Origin-Resource-Policy": "cross-origin",
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
format: "es",
|
||||
rollupOptions: {
|
||||
output: {
|
||||
format: "es",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user