mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Improve snapshot error messages (#83785)
This commit is contained in:
parent
25c3b4c95e
commit
5d05eeaab9
1 changed files with 6 additions and 3 deletions
|
@ -24,7 +24,6 @@ import {
|
|||
addSerializer,
|
||||
} from 'jest-snapshot';
|
||||
import path from 'path';
|
||||
import expect from '@kbn/expect';
|
||||
import prettier from 'prettier';
|
||||
import babelTraverse from '@babel/traverse';
|
||||
import { flatten, once } from 'lodash';
|
||||
|
@ -227,7 +226,9 @@ function expectToMatchSnapshot(snapshotContext: SnapshotContext, received: any)
|
|||
const matcher = toMatchSnapshot.bind(snapshotContext as any);
|
||||
const result = matcher(received);
|
||||
|
||||
expect(result.pass).to.eql(true, result.message());
|
||||
if (!result.pass) {
|
||||
throw new Error(result.message());
|
||||
}
|
||||
}
|
||||
|
||||
function expectToMatchInlineSnapshot(
|
||||
|
@ -239,5 +240,7 @@ function expectToMatchInlineSnapshot(
|
|||
|
||||
const result = arguments.length === 2 ? matcher(received) : matcher(received, _actual);
|
||||
|
||||
expect(result.pass).to.eql(true, result.message());
|
||||
if (!result.pass) {
|
||||
throw new Error(result.message());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue