expect-webdriverio 5.3.0 → 5.3.1

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.
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { expect } from 'expect';
3
+ import { stripSnapshotIndentation } from '@vitest/snapshot';
3
4
  import { SnapshotService } from '../snapshot.js';
4
5
  function returnSnapshotError(snapshotError) {
5
6
  try {
@@ -73,9 +74,16 @@ export function toMatchInlineSnapshot(received, inlineSnapshot, message) {
73
74
  ...stack.slice(3)
74
75
  ].join('\n');
75
76
  }
76
- error.stack = error.stack?.split('\n').filter((line) => (line.includes('__INLINE_SNAPSHOT__') ||
77
+ const trace = error.stack?.split('\n').filter((line) => (line.includes('__INLINE_SNAPSHOT__') ||
77
78
  !(line.includes('__EXTERNAL_MATCHER_TRAP__') ||
78
- line.includes(`expect-webdriverio${path.sep}lib${path.sep}matchers${path.sep}snapshot.js:`)))).join('\n');
79
+ line.includes(`expect-webdriverio${path.sep}lib${path.sep}matchers${path.sep}snapshot.js:`)))) || [];
80
+ if (process.env.WDIO_INTERNAL_TEST) {
81
+ trace.splice(2, 1);
82
+ }
83
+ if (inlineSnapshot) {
84
+ inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
85
+ }
86
+ error.stack = trace.join('\n');
79
87
  return toMatchSnapshotHelper(received, message, {
80
88
  inlineSnapshot,
81
89
  error
package/lib/snapshot.js CHANGED
@@ -43,9 +43,15 @@ export class SnapshotService {
43
43
  : options?.updateState
44
44
  ? options.updateState
45
45
  : 'new';
46
+ const snapshotFormatConfig = options?.snapshotFormat ? {
47
+ printBasicPrototype: false,
48
+ escapeString: false,
49
+ ...options.snapshotFormat
50
+ } : undefined;
46
51
  __classPrivateFieldSet(this, _SnapshotService_options, {
47
52
  updateSnapshot,
48
- snapshotEnvironment: new WebdriverIOSnapshotEnvironment(options?.resolveSnapshotPath)
53
+ snapshotEnvironment: new WebdriverIOSnapshotEnvironment(options?.resolveSnapshotPath),
54
+ ...(snapshotFormatConfig && { snapshotFormat: snapshotFormatConfig })
49
55
  }, "f");
50
56
  }
51
57
  get currentFilePath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",
@@ -58,28 +58,28 @@
58
58
  "prepare": "husky install"
59
59
  },
60
60
  "dependencies": {
61
- "@vitest/snapshot": "^3.2.1",
62
- "expect": "^29.7.0",
63
- "jest-matcher-utils": "^29.7.0",
61
+ "@vitest/snapshot": "^3.2.4",
62
+ "expect": "^30.0.0",
63
+ "jest-matcher-utils": "^30.0.0",
64
64
  "lodash.isequal": "^4.5.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/debug": "^4.1.12",
68
- "@types/jest": "^29.5.14",
68
+ "@types/jest": "^30.0.0",
69
69
  "@types/lodash.isequal": "^4.5.8",
70
- "@types/node": "^22.15.29",
71
- "@vitest/coverage-v8": "^3.2.1",
70
+ "@types/node": "^24.0.3",
71
+ "@vitest/coverage-v8": "^3.2.4",
72
72
  "@wdio/eslint": "^0.1.1",
73
73
  "@wdio/types": "^9.15.0",
74
74
  "c8": "^10.1.3",
75
- "eslint": "^9.28.0",
75
+ "eslint": "^9.29.0",
76
76
  "husky": "^9.1.7",
77
77
  "npm-run-all2": "^8.0.4",
78
78
  "release-it": "^19.0.3",
79
79
  "rimraf": "^6.0.1",
80
80
  "shelljs": "^0.10.0",
81
81
  "typescript": "^5.8.3",
82
- "vitest": "^3.2.1",
82
+ "vitest": "^3.2.4",
83
83
  "webdriverio": "^9.15.0"
84
84
  },
85
85
  "peerDependencies": {