MCPcopy
hub / github.com/vitest-dev/vitest / getError

Function getError

test/core/test/jest-expect.test.ts:1401–1410  ·  view source on GitHub ↗
(f: () => unknown)

Source from the content-addressed store, hash-verified

1399}
1400
1401function getError(f: () => unknown) {
1402 try {
1403 f()
1404 }
1405 catch (error) {
1406 const processed = processError(error)
1407 return [stripVTControlCharacters(processed.message), stripVTControlCharacters(trim(processed.diff!))]
1408 }
1409 return expect.unreachable()
1410}
1411
1412it('toMatchObject', () => {
1413 expect(() => expect(null).toMatchObject(new Set()))

Callers 1

Calls 3

processErrorFunction · 0.90
trimFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected