mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-27 03:18:37 +00:00
### Fixed and refactored
- Fixed the inexplicable behaviour when retrieving chunks from the network.
- Chunk manager has been layered to responsible its own areas and duties. e.g., `DatabaseWriteLayer`, `DatabaseReadLayer`, `NetworkLayer`, `CacheLayer`,and `ArrivalWaitLayer`.
- All layers have test now!
- `LayeredChunkManager` has been implemented to manage these layers. Also tested.
- `EntryManager` has been mostly rewritten, and also tested.
- Now we can configure `Never warn` for remote storage size notification, again.
This commit is contained in:
8
devs.md
8
devs.md
@@ -52,6 +52,7 @@ Hence, the new feature should be implemented as follows:
|
||||
### Commands
|
||||
|
||||
```bash
|
||||
npm run test:unit # Run unit tests with vitest (or `npm run test:unit:coverage` for coverage)
|
||||
npm run check # TypeScript and svelte type checking
|
||||
npm run dev # Development build with auto-rebuild (uses .env for test vault paths)
|
||||
npm run build # Production build
|
||||
@@ -67,8 +68,11 @@ npm test # Run vitest tests (requires Docker services)
|
||||
|
||||
### Testing Infrastructure
|
||||
|
||||
- **Deno Tests**: Unit tests for platform-independent code (e.g., `HashManager.test.ts`)
|
||||
- **Vitest** (`vitest.config.ts`): E2E test by Browser-based-harness using Playwright
|
||||
- ~~**Deno Tests**: Unit tests for platform-independent code (e.g., `HashManager.test.ts`)~~
|
||||
- This is now obsolete, migrated to vitest.
|
||||
- **Vitest** (`vitest.config.ts`): E2E test by Browser-based-harness using Playwright, unit tests.
|
||||
- Unit tests should be `*.unit.spec.ts` and placed alongside the implementation file (e.g., `ChunkFetcher.unit.spec.ts`).
|
||||
|
||||
- **Docker Services**: Tests require CouchDB, MinIO (S3), and P2P services:
|
||||
```bash
|
||||
npm run test:docker-all:start # Start all test services
|
||||
|
||||
2
src/lib
2
src/lib
Submodule src/lib updated: 29f2a6aa4f...2ed1925ca7
@@ -89,7 +89,6 @@ export default defineConfig({
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
obsidian: path.resolve(__dirname, "./test/harness/obsidian-mock.ts"),
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
"@lib": path.resolve(__dirname, "./src/lib/src"),
|
||||
src: path.resolve(__dirname, "./src"),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
import { playwright } from "@vitest/browser-playwright";
|
||||
import viteConfig from "./vitest.config.common";
|
||||
import path from "path";
|
||||
import dotenv from "dotenv";
|
||||
import { grantClipboardPermissions, openWebPeer, closeWebPeer, acceptWebPeer } from "./test/lib/commands";
|
||||
const defEnv = dotenv.config({ path: ".env" }).parsed;
|
||||
@@ -12,6 +13,11 @@ const headless = !debuggerEnabled && !enableUI;
|
||||
export default mergeConfig(
|
||||
viteConfig,
|
||||
defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
obsidian: path.resolve(__dirname, "./test/harness/obsidian-mock.ts"),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
env: env,
|
||||
testTimeout: 40000,
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
import viteConfig from "./vitest.config.common";
|
||||
|
||||
const importOnlyFiles = ["**/encryption/encryptHKDF.ts"];
|
||||
export default mergeConfig(
|
||||
viteConfig,
|
||||
defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
obsidian: "", // prevent accidental imports of obsidian types in unit tests,
|
||||
},
|
||||
},
|
||||
test: {
|
||||
name: "unit-tests",
|
||||
include: ["**/*unit.test.ts", "**/*.unit.spec.ts"],
|
||||
exclude: ["test/**"],
|
||||
coverage: {
|
||||
include: ["src/**/*.ts"],
|
||||
exclude: ["**/*.test.ts", "src/lib/**/*.test.ts", "**/_*", "src/lib/apps", "src/lib/src/cli"],
|
||||
exclude: [
|
||||
"**/*.test.ts",
|
||||
"src/lib/**/*.test.ts",
|
||||
"**/_*",
|
||||
"src/lib/apps",
|
||||
"src/lib/src/cli",
|
||||
"**/*_obsolete.ts",
|
||||
...importOnlyFiles,
|
||||
],
|
||||
provider: "v8",
|
||||
reporter: ["text", "json", "html"],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user