expect-webdriverio 4.10.1 → 4.11.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/lib/index.js CHANGED
@@ -21,5 +21,5 @@ export const setDefaultOptions = (options = {}) => {
21
21
  });
22
22
  };
23
23
  export const setOptions = setDefaultOptions;
24
- export * from './snapshot.js';
24
+ export { SnapshotService } from './snapshot.js';
25
25
  export * as utils from './utils.js';
package/lib/snapshot.js CHANGED
@@ -1,32 +1,35 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
1
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
2
  if (kind === "m") throw new TypeError("Private method is not writable");
8
3
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
5
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
6
  };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
12
  var _SnapshotService_instances, _SnapshotService_currentFilePath, _SnapshotService_currentTestName, _SnapshotService_options, _SnapshotService_snapshotResults, _SnapshotService_snapshotEnvironment, _SnapshotService_snapshotClient, _SnapshotService_isEqual;
13
13
  import { expect } from '@wdio/globals';
14
14
  import { SnapshotClient } from '@vitest/snapshot';
15
15
  import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
16
16
  let service;
17
17
  export class SnapshotService {
18
- constructor(updateState) {
18
+ constructor(options) {
19
19
  _SnapshotService_instances.add(this);
20
20
  _SnapshotService_currentFilePath.set(this, void 0);
21
21
  _SnapshotService_currentTestName.set(this, void 0);
22
22
  _SnapshotService_options.set(this, void 0);
23
23
  _SnapshotService_snapshotResults.set(this, []);
24
- _SnapshotService_snapshotEnvironment.set(this, new NodeSnapshotEnvironment());
24
+ _SnapshotService_snapshotEnvironment.set(this, void 0);
25
25
  _SnapshotService_snapshotClient.set(this, new SnapshotClient({
26
26
  isEqual: __classPrivateFieldGet(this, _SnapshotService_instances, "m", _SnapshotService_isEqual).bind(this),
27
27
  }));
28
+ __classPrivateFieldSet(this, _SnapshotService_snapshotEnvironment, new NodeSnapshotEnvironment({
29
+ snapshotsDirName: options?.snapshotsDirName
30
+ }), "f");
28
31
  __classPrivateFieldSet(this, _SnapshotService_options, {
29
- updateSnapshot: updateState,
32
+ updateSnapshot: options?.updateState || 'new',
30
33
  snapshotEnvironment: __classPrivateFieldGet(this, _SnapshotService_snapshotEnvironment, "f"),
31
34
  }, "f");
32
35
  }
@@ -54,9 +57,9 @@ export class SnapshotService {
54
57
  }
55
58
  __classPrivateFieldGet(this, _SnapshotService_snapshotResults, "f").push(result);
56
59
  }
57
- static initiate(updateState = 'new') {
60
+ static initiate(options) {
58
61
  if (!service) {
59
- service = new SnapshotService(updateState);
62
+ service = new SnapshotService(options);
60
63
  }
61
64
  return service;
62
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "4.10.1",
3
+ "version": "4.11.0",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",
@@ -3,10 +3,13 @@ declare namespace ExpectWebdriverIO {
3
3
  function setOptions(options: DefaultOptions): void
4
4
  function getConfig(): any
5
5
 
6
+ interface SnapshotServiceArgs {
7
+ updateState?: import('@vitest/snapshot').SnapshotUpdateState
8
+ snapshotsDirName?: string
9
+ }
10
+
6
11
  class SnapshotService {
7
- static initiate(
8
- updateState?: import('@vitest/snapshot').SnapshotUpdateState
9
- ): import('@wdio/types').Services.ServiceInstance & {
12
+ static initiate(options: SnapshotServiceArgs): import('@wdio/types').Services.ServiceInstance & {
10
13
  results: import('@vitest/snapshot').SnapshotResult[]
11
14
  }
12
15
  }