expect-webdriverio 4.9.0 → 4.9.2

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.
@@ -60,8 +60,20 @@ export function toMatchSnapshot(received, message) {
60
60
  return toMatchSnapshotHelper(received, message);
61
61
  }
62
62
  export function toMatchInlineSnapshot(received, inlineSnapshot, message) {
63
+ const browserErrorStack = this.errorStack;
63
64
  function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
64
65
  const error = new Error('inline snapshot');
66
+ if (browserErrorStack && error.stack) {
67
+ error.stack = [
68
+ ...error.stack.split('\n').slice(0, 3),
69
+ ...browserErrorStack
70
+ .split('\n')
71
+ .slice(2)
72
+ .map((line) => line
73
+ .replace(/http:\/\/localhost:\d+/g, '')
74
+ .replace('/@fs/', '/'))
75
+ ].join('\n');
76
+ }
65
77
  error.stack = error.stack?.split('\n').filter((line) => (line.includes('__INLINE_SNAPSHOT__') ||
66
78
  !(line.includes('__EXTERNAL_MATCHER_TRAP__') ||
67
79
  line.includes(`expect-webdriverio${path.sep}lib${path.sep}matchers${path.sep}snapshot.js:`)))).join('\n');
package/lib/snapshot.js CHANGED
@@ -47,7 +47,7 @@ export class SnapshotService {
47
47
  __classPrivateFieldSet(this, _SnapshotService_currentTestName, `${test.parent} > ${test.title}`, "f");
48
48
  __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").startCurrentRun(test.file, test.fullTitle, __classPrivateFieldGet(this, _SnapshotService_options, "f"));
49
49
  }
50
- async afterTest() {
50
+ async after() {
51
51
  const result = await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").finishCurrentRun();
52
52
  if (!result) {
53
53
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "4.9.0",
3
+ "version": "4.9.2",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",