mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-17 00:16:06 +03: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
|
### Commands
|
||||||
|
|
||||||
```bash
|
```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 check # TypeScript and svelte type checking
|
||||||
npm run dev # Development build with auto-rebuild (uses .env for test vault paths)
|
npm run dev # Development build with auto-rebuild (uses .env for test vault paths)
|
||||||
npm run build # Production build
|
npm run build # Production build
|
||||||
@@ -67,8 +68,11 @@ npm test # Run vitest tests (requires Docker services)
|
|||||||
|
|
||||||
### Testing Infrastructure
|
### Testing Infrastructure
|
||||||
|
|
||||||
- **Deno Tests**: Unit tests for platform-independent code (e.g., `HashManager.test.ts`)
|
- ~~**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
|
- 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:
|
- **Docker Services**: Tests require CouchDB, MinIO (S3), and P2P services:
|
||||||
```bash
|
```bash
|
||||||
npm run test:docker-all:start # Start all test services
|
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: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
obsidian: path.resolve(__dirname, "./test/harness/obsidian-mock.ts"),
|
|
||||||
"@": path.resolve(__dirname, "./src"),
|
"@": path.resolve(__dirname, "./src"),
|
||||||
"@lib": path.resolve(__dirname, "./src/lib/src"),
|
"@lib": path.resolve(__dirname, "./src/lib/src"),
|
||||||
src: path.resolve(__dirname, "./src"),
|
src: path.resolve(__dirname, "./src"),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { defineConfig, mergeConfig } from "vitest/config";
|
import { defineConfig, mergeConfig } from "vitest/config";
|
||||||
import { playwright } from "@vitest/browser-playwright";
|
import { playwright } from "@vitest/browser-playwright";
|
||||||
import viteConfig from "./vitest.config.common";
|
import viteConfig from "./vitest.config.common";
|
||||||
|
import path from "path";
|
||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
import { grantClipboardPermissions, openWebPeer, closeWebPeer, acceptWebPeer } from "./test/lib/commands";
|
import { grantClipboardPermissions, openWebPeer, closeWebPeer, acceptWebPeer } from "./test/lib/commands";
|
||||||
const defEnv = dotenv.config({ path: ".env" }).parsed;
|
const defEnv = dotenv.config({ path: ".env" }).parsed;
|
||||||
@@ -12,6 +13,11 @@ const headless = !debuggerEnabled && !enableUI;
|
|||||||
export default mergeConfig(
|
export default mergeConfig(
|
||||||
viteConfig,
|
viteConfig,
|
||||||
defineConfig({
|
defineConfig({
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
obsidian: path.resolve(__dirname, "./test/harness/obsidian-mock.ts"),
|
||||||
|
},
|
||||||
|
},
|
||||||
test: {
|
test: {
|
||||||
env: env,
|
env: env,
|
||||||
testTimeout: 40000,
|
testTimeout: 40000,
|
||||||
|
|||||||
@@ -1,16 +1,30 @@
|
|||||||
import { defineConfig, mergeConfig } from "vitest/config";
|
import { defineConfig, mergeConfig } from "vitest/config";
|
||||||
import viteConfig from "./vitest.config.common";
|
import viteConfig from "./vitest.config.common";
|
||||||
|
|
||||||
|
const importOnlyFiles = ["**/encryption/encryptHKDF.ts"];
|
||||||
export default mergeConfig(
|
export default mergeConfig(
|
||||||
viteConfig,
|
viteConfig,
|
||||||
defineConfig({
|
defineConfig({
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
obsidian: "", // prevent accidental imports of obsidian types in unit tests,
|
||||||
|
},
|
||||||
|
},
|
||||||
test: {
|
test: {
|
||||||
name: "unit-tests",
|
name: "unit-tests",
|
||||||
include: ["**/*unit.test.ts", "**/*.unit.spec.ts"],
|
include: ["**/*unit.test.ts", "**/*.unit.spec.ts"],
|
||||||
exclude: ["test/**"],
|
exclude: ["test/**"],
|
||||||
coverage: {
|
coverage: {
|
||||||
include: ["src/**/*.ts"],
|
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",
|
provider: "v8",
|
||||||
reporter: ["text", "json", "html"],
|
reporter: ["text", "json", "html"],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user