obsidian-testing-framework 0.3.6 → 0.3.8

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.
Files changed (2) hide show
  1. package/lib/index.js +10 -9
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { test as base, inject } from "vitest";
2
2
  import { _electron as electron } from "playwright";
3
3
  import path from "path";
4
+ import os from "os";
4
5
  import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmdirSync, writeFileSync, } from "fs";
5
6
  import { pageUtils, waitForIndexingComplete } from "./util.js";
6
7
  import { randomBytes } from "crypto";
@@ -21,8 +22,7 @@ function findConfig() {
21
22
  }
22
23
  return configLocation;
23
24
  }
24
- function generateVaultConfig(vault, concurrent, vaultPoolDir) {
25
- const vaultHash = randomBytes(8).toString("hex").toLocaleLowerCase();
25
+ function generateVaultConfig(vault, vaultHash, concurrent, vaultPoolDir) {
26
26
  let configLocation = findConfig();
27
27
  console.log("vault is", vault, existsSync(vault));
28
28
  const obsidianConfigFile = path.join(configLocation, "obsidian.json");
@@ -58,7 +58,7 @@ export const test = base.extend({
58
58
  await run("");
59
59
  return;
60
60
  }
61
- const prefix = "obsidian-testing-framework-vault-pool-";
61
+ const prefix = path.join(os.tmpdir(), "obsidian-testing-framework-vault-pool-");
62
62
  const vaultPoolDir = mkdtempSync(prefix);
63
63
  await run(vaultPoolDir);
64
64
  rmdirSync(vaultPoolDir, { recursive: true });
@@ -70,19 +70,20 @@ export const test = base.extend({
70
70
  { scope: "worker", auto: true },
71
71
  ],
72
72
  ___vaultId: [
73
- async ({ vaultPoolDir }, run) => {
74
- const vault = inject("vault");
75
- const concurrent = inject("concurrent") ?? "copy";
73
+ async ({}, run) => {
76
74
  process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
77
- const vaultId = generateVaultConfig(vault, concurrent, vaultPoolDir);
78
- await run(vaultId);
75
+ const vaultHash = randomBytes(8).toString("hex").toLocaleLowerCase();
76
+ await run(vaultHash);
79
77
  },
80
78
  { auto: true },
81
79
  ],
82
80
  electronApp: [
83
- async ({ ___vaultId: vaultId }, run) => {
81
+ async ({ ___vaultId: vaultId, vaultPoolDir }, run) => {
84
82
  const obsidianPath = inject("obsidianPath") ?? undefined;
83
+ const concurrent = inject("concurrent") ?? "copy";
84
+ const vault = inject("vault");
85
85
  console.log("asar located at:", getExe(obsidianPath));
86
+ generateVaultConfig(vault, vaultId, concurrent, vaultPoolDir);
86
87
  let uriArg = "";
87
88
  if (vaultId) {
88
89
  if (!!vaultId) {
package/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  ".": "./lib/index.js"
28
28
  },
29
29
  "readme": "",
30
- "version": "0.3.6",
30
+ "version": "0.3.8",
31
31
  "main": "./lib/index.js",
32
32
  "typings": "./lib/index.d.ts",
33
33
  "repository": {