UNPKG

@zyf2e/mitojs

Version:

A SDK for monitoring browser errors

25 lines (23 loc) 606 B
import { nativeTryCatch } from '@/utils' describe('exception.ts', () => { it('should nativeTryCatch func work', () => { const errMsg = 'unti' const throwErrorFunc = () => { throw new Error(errMsg) } nativeTryCatch(throwErrorFunc, (err: Error) => { expect(err.message).toBe(errMsg) }) }) it("should nativeTryCatch's two params not run under normal circumstances", () => { const normalFun = () => { const a = 1 a + 1 === 2 } let isRun = false nativeTryCatch(normalFun, () => { isRun = true }) expect(isRun).toBeFalsy() }) })