@sdc-monitor/demo
Version:
<div align="center"> <a href="#" target="_blank"> <img src="https://i.loli.net/2021/07/28/EvPwd4NjVH3tBfO.jpg" alt="mito-logo" height="90"> </a> <p>A Lightweight SDK For Monitor Web</p>
25 lines (23 loc) • 605 B
text/typescript
import { nativeTryCatch } from '../src'
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()
})
})