This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 45
45
"prepare-dist" : " rimraf ./dist && tsc && tsx ./bin/copy-dist.ts" ,
46
46
"update-build-info" : " tsx bin/update-build-info.ts" ,
47
47
"errors" : " tsc --watch --noEmit" ,
48
- "integration-edit-db" : " cross-env TRILIUM_INTEGRATION_TEST=edit TRILIUM_PORT=8081 TRILIUM_DATA_DIR=./integration-tests/db nodemon src/www.ts"
48
+ "integration-edit-db" : " cross-env TRILIUM_INTEGRATION_TEST=edit TRILIUM_PORT=8081 TRILIUM_DATA_DIR=./integration-tests/db nodemon src/www.ts" ,
49
+ "integration-mem-db" : " cross-env TRILIUM_INTEGRATION_TEST=memory TRILIUM_PORT=8082 TRILIUM_DATA_DIR=./integration-tests/db nodemon src/www.ts"
49
50
},
50
51
"dependencies" : {
51
52
"@braintree/sanitize-url" : " ^7.1.0" ,
Original file line number Diff line number Diff line change @@ -14,7 +14,18 @@ import ws from "./ws.js";
14
14
import becca_loader from "../becca/becca_loader.js" ;
15
15
import entity_changes from "./entity_changes.js" ;
16
16
17
- const dbConnection : DatabaseType = new Database ( dataDir . DOCUMENT_PATH ) ;
17
+ function buildDatabase ( path : string ) {
18
+ if ( process . env . TRILIUM_INTEGRATION_TEST === "memory" ) {
19
+ // This allows a database that is read normally but is kept in memory and discards all modifications.
20
+ const dbBuffer = fs . readFileSync ( path ) ;
21
+ return new Database ( dbBuffer ) ;
22
+ }
23
+
24
+ return new Database ( dataDir . DOCUMENT_PATH ) ;
25
+ }
26
+
27
+ const dbConnection : DatabaseType = buildDatabase ( dataDir . DOCUMENT_PATH ) ;
28
+
18
29
if ( ! process . env . TRILIUM_INTEGRATION_TEST ) {
19
30
dbConnection . pragma ( 'journal_mode = WAL' ) ;
20
31
}
You can’t perform that action at this time.
0 commit comments