obsidian-testing-framework 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/electron-singleton.js +4 -0
- package/lib/index.js +1 -0
- package/package.json +2 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { _electron as electron } from "playwright";
|
|
2
2
|
import { addConsoleListener } from "./internal-util.js";
|
|
3
|
+
import { Mutex } from "async-mutex";
|
|
3
4
|
const singleton = {
|
|
4
5
|
app: null,
|
|
5
6
|
};
|
|
7
|
+
const mutex = new Mutex();
|
|
6
8
|
export async function getOrCreateApp(obsidianPath, uriArg) {
|
|
7
9
|
if (singleton.app) {
|
|
8
10
|
return singleton.app;
|
|
9
11
|
}
|
|
12
|
+
const release = await mutex.acquire();
|
|
10
13
|
const app = await electron.launch({
|
|
11
14
|
timeout: 60000,
|
|
12
15
|
args: [obsidianPath, uriArg].filter((a) => !!a),
|
|
13
16
|
});
|
|
14
17
|
addConsoleListener(app);
|
|
15
18
|
singleton.app = app;
|
|
19
|
+
await release();
|
|
16
20
|
return app;
|
|
17
21
|
}
|
package/lib/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export const test = base.extend({
|
|
|
47
47
|
const experimentalUseSingleton = inject("experimentalUseSingleton") ?? false;
|
|
48
48
|
const vault = inject("vault");
|
|
49
49
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
|
|
50
|
+
console.log({ obsidianPath, experimentalUseSingleton });
|
|
50
51
|
console.log("asar located at:", getExe(obsidianPath));
|
|
51
52
|
let uriArg = "";
|
|
52
53
|
if (vault) {
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"@codemirror/view": "^6.0.1",
|
|
9
9
|
"@playwright/test": "^1.58.2",
|
|
10
10
|
"asar": "^3.2.0",
|
|
11
|
+
"async-mutex": "^0.5.0",
|
|
11
12
|
"electron": "^33.0.2",
|
|
12
13
|
"obsidian": "latest",
|
|
13
14
|
"playwright": "^1.58.2",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
".": "./lib/index.js"
|
|
26
27
|
},
|
|
27
28
|
"readme": "",
|
|
28
|
-
"version": "0.2.
|
|
29
|
+
"version": "0.2.5",
|
|
29
30
|
"main": "./lib/index.js",
|
|
30
31
|
"typings": "./lib/index.d.ts",
|
|
31
32
|
"repository": {
|