obsidian-testing-framework 0.1.7 → 0.1.9
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/index.d.ts +2 -1
- package/lib/index.js +13 -5
- package/package.json +12 -5
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export interface ObsidianTestingConfig {
|
|
2
2
|
vault?: string;
|
|
3
|
+
obsidianPath?: string;
|
|
3
4
|
}
|
|
4
|
-
export declare function getExe(): string;
|
|
5
|
+
export declare function getExe(obsidianPath?: string): string;
|
|
5
6
|
export declare const test: import("vitest").TestAPI<{
|
|
6
7
|
page: import("playwright-core").Page;
|
|
7
8
|
obsidian: ObsidianTestingConfig;
|
package/lib/index.js
CHANGED
|
@@ -4,10 +4,16 @@ import path from "path";
|
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
5
|
import { pageUtils, waitForIndexingComplete } from "./util.js";
|
|
6
6
|
import { randomBytes } from "crypto";
|
|
7
|
-
export function getExe() {
|
|
7
|
+
export function getExe(obsidianPath) {
|
|
8
8
|
checkToy();
|
|
9
|
+
if (obsidianPath) {
|
|
10
|
+
return path.join(obsidianPath, "Resources", "app.asar");
|
|
11
|
+
}
|
|
9
12
|
if (process.platform == "win32") {
|
|
10
|
-
|
|
13
|
+
const p = path.join(process.env.LOCALAPPDATA, "Obsidian", "Resources", "app.asar");
|
|
14
|
+
if (existsSync(p)) {
|
|
15
|
+
return p;
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
const possibleDirs = [
|
|
13
19
|
"/opt/Obsidian",
|
|
@@ -66,10 +72,12 @@ function generateVaultConfig(vault) {
|
|
|
66
72
|
// @ts-ignore some error about a string type now having `undefined` as part of it's union
|
|
67
73
|
export const test = base.extend({
|
|
68
74
|
electronApp: [
|
|
69
|
-
async ({}, run) => {
|
|
75
|
+
async ({ obsidian }, run) => {
|
|
76
|
+
console.log("obsidian", obsidian);
|
|
77
|
+
const { obsidianPath = undefined } = obsidian ?? {};
|
|
70
78
|
const vault = inject("vault");
|
|
71
79
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
|
|
72
|
-
console.log("asar located at:", getExe());
|
|
80
|
+
console.log("asar located at:", getExe(obsidianPath));
|
|
73
81
|
let uriArg = "";
|
|
74
82
|
if (vault) {
|
|
75
83
|
let id = generateVaultConfig(vault);
|
|
@@ -79,7 +87,7 @@ export const test = base.extend({
|
|
|
79
87
|
}
|
|
80
88
|
const electronApp = await electron.launch({
|
|
81
89
|
timeout: 60000,
|
|
82
|
-
args: [getExe(), uriArg].filter((a) => !!a),
|
|
90
|
+
args: [getExe(obsidianPath), uriArg].filter((a) => !!a),
|
|
83
91
|
});
|
|
84
92
|
electronApp.on("console", async (msg) => {
|
|
85
93
|
console.log(...(await Promise.all(msg.args().map((a) => a.jsonValue()))));
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-testing-framework",
|
|
3
3
|
"packageManager": "yarn@4.5.1",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"dependencies": {
|
|
5
6
|
"@codemirror/language": "https://github.com/lishid/cm-language",
|
|
6
7
|
"@codemirror/state": "^6.0.1",
|
|
7
8
|
"@codemirror/view": "^6.0.1",
|
|
8
|
-
"@playwright/test": "^1.
|
|
9
|
+
"@playwright/test": "^1.58.2",
|
|
9
10
|
"asar": "^3.2.0",
|
|
10
11
|
"electron": "^33.0.2",
|
|
11
12
|
"obsidian": "latest",
|
|
12
|
-
"playwright": "^1.
|
|
13
|
+
"playwright": "^1.58.2",
|
|
13
14
|
"tmp": "^0.2.3",
|
|
14
15
|
"typescript": "^5.6.3",
|
|
15
16
|
"xvfb-maybe": "^0.2.1"
|
|
@@ -18,8 +19,13 @@
|
|
|
18
19
|
"./lib",
|
|
19
20
|
"../../README.md"
|
|
20
21
|
],
|
|
22
|
+
"exports": {
|
|
23
|
+
"./fixture": "./lib/fixtures.js",
|
|
24
|
+
"./util": "./lib/util.js",
|
|
25
|
+
".": "./lib/index.js"
|
|
26
|
+
},
|
|
21
27
|
"readme": "",
|
|
22
|
-
"version": "0.1.
|
|
28
|
+
"version": "0.1.9",
|
|
23
29
|
"main": "./lib/index.js",
|
|
24
30
|
"typings": "./lib/index.d.ts",
|
|
25
31
|
"repository": {
|
|
@@ -29,11 +35,12 @@
|
|
|
29
35
|
"scripts": {
|
|
30
36
|
"build": "tsc",
|
|
31
37
|
"lint": "tslint -c tslint.json src/**/*.ts",
|
|
32
|
-
"prepublishOnly": "rm README.md
|
|
38
|
+
"prepublishOnly": "pwsh -command 'rm README.md; cp ../../README.md . && rimraf lib && npm run build'",
|
|
39
|
+
"prepare": "yarn run build"
|
|
33
40
|
},
|
|
34
41
|
"devDependencies": {
|
|
35
42
|
"@types/tmp": "^0",
|
|
36
43
|
"rimraf": "^6.0.1",
|
|
37
|
-
"vitest": "^
|
|
44
|
+
"vitest": "^4.0.18"
|
|
38
45
|
}
|
|
39
46
|
}
|