wdio-obsidian-service 2.3.3 → 3.0.0

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/README.md CHANGED
@@ -80,7 +80,7 @@ export const config: WebdriverIO.Config = {
80
80
  mochaOpts: {
81
81
  ui: 'bdd',
82
82
  timeout: 60000,
83
- // You can set mocha settings like "retry" and "bail"
83
+ // You can set mocha settings like "retries" and "bail"
84
84
  },
85
85
  logLevel: "warn",
86
86
  }
package/dist/index.d.ts CHANGED
@@ -287,17 +287,26 @@ type ObsidianBrowserCommands = typeof browserCommands & {
287
287
  * {@link ObsidianPage.resetVault} instead, which modifies vault files in place without rebooting Obsidian. If all
288
288
  * your tests use the same vault, you can also just set the vault in the `wdio.conf.mts` capabilities section.
289
289
  *
290
- * @param params.vault Path to the vault to open. The vault will be copied, so any changes made in your tests won't
291
- * be persited to the original. If omitted, it will reboot Obsidian with the current vault without creating a
292
- * new copy of the vault.
290
+ * @param params.vault Path to the vault to open. The vault will be copied by default, so any changes made in your
291
+ * tests won't be persisted to the original. Set `copy` to `false` to use the vault in-place. If omitted, it will
292
+ * reboot Obsidian with the current vault without creating a new copy of the vault.
293
+ * @param params.copy Whether to copy the vault to a temporary directory before running tests in it (default true).
294
+ * When `true` (the default), the vault is copied so that tests don't modify the original and parallel tests will
295
+ * work on separate copies of the vault. When `false`, the vault is used in-place, useful for debugging or
296
+ * read-only tests on large vaults.
297
+ *
298
+ * **WARNING**: With `copy: false`, even with "read-only" tests, Obsidian will often make changes under
299
+ * `.obsidian` that will get persisted. This also means that running parallel tests on the same vault with
300
+ * `copy: false` is unsafe.
293
301
  * @param params.plugins List of plugin ids to enable. If omitted it will keep current plugin list. Note, all the
294
- * plugins must be defined in your wdio.conf.mts capabilities. You can also use the enablePlugin and
295
- * disablePlugin commands to change plugins without relaunching Obsidian.
302
+ * plugins must be defined in your wdio.conf.mts capabilities. You can also use the enablePlugin and disablePlugin
303
+ * commands to change plugins without relaunching Obsidian.
296
304
  * @param params.theme Name of the theme to enable. If omitted it will keep the current theme. Pass "default" to
297
- * switch back to the default theme. Like with plugins, the theme must be defined in wdio.conf.mts.
305
+ * switch back to the default theme. Like with plugins, the theme must be defined in wdio.conf.mts.
298
306
  */
299
307
  reloadObsidian(params?: {
300
308
  vault?: string;
309
+ copy?: boolean;
301
310
  plugins?: string[];
302
311
  theme?: string;
303
312
  }): Promise<void>;
@@ -421,11 +430,24 @@ interface ObsidianCapabilityOptions {
421
430
  /**
422
431
  * The path to the vault to open.
423
432
  *
424
- * The vault will be copied, so any changes made in your tests won't affect the original. If omitted, no vault will
425
- * be opened and you'll need to call {@link ObsidianBrowserCommands.reloadObsidian|browser.reloadObsidian} to open a
426
- * vault during your tests. Path is relative to your `wdio.conf.mts`.
433
+ * By default the vault will be copied to a temporary directory, so any changes made in your tests won't affect
434
+ * the original. Set {@link copy} to `false` to use the vault in-place. If omitted, no vault will be opened and
435
+ * you'll need to call {@link ObsidianBrowserCommands.reloadObsidian|browser.reloadObsidian} to open a vault
436
+ * during your tests. Path is relative to your `wdio.conf.mts`.
427
437
  */
428
438
  vault?: string;
439
+ /**
440
+ * Whether to copy the vault to a temporary directory before running tests in it (the default).
441
+ *
442
+ * When `true` (the default), the vault is copied so that tests don't modify the original and parallel tests will
443
+ * work on separate copies of the vault. When `false`, the vault is used in-place, useful for debugging or
444
+ * read-only tests on large vaults.
445
+ *
446
+ * **WARNING**: With `copy: false`, even with "read-only" tests, Obsidian will often make changes under `.obsidian`
447
+ * that will get persisted. This also means that running parallel tests on the same vault with `copy: false` is
448
+ * unsafe.
449
+ */
450
+ copy?: boolean;
429
451
  /**
430
452
  * Set to true to emulate mobile on the Electron desktop app. This uses Obsidian `app.emulateMobile()` to switch
431
453
  * Obsidian to the mobile UI, and you can use Chrome's mobileEmulation to set the screen size. You can compare
@@ -531,11 +553,9 @@ declare class ObsidianWorkerService implements Services.ServiceInstance {
531
553
  private browser;
532
554
  /** Directories to clean up after the tests */
533
555
  private tmpDirs;
534
- /** Path on Android devices to store temporary vaults */
535
- private androidVaultDir;
536
556
  constructor(options: ObsidianServiceOptions, capabilities: WebdriverIO.Capabilities, config: Options.Testrunner);
537
557
  /**
538
- * Creates a copy of the vault with plugins and themes installed
558
+ * Sets up the vault with plugins and themes installed, optionally copying it first.
539
559
  */
540
560
  private setupVault;
541
561
  /**