fix: don't overwrite global constructor names in remote (#20637)

* fix: don't overwrite global constructor names in remote

* fake constructor names better, and improve error serialization
This commit is contained in:
Jeremy Apthorp 2019-10-20 23:48:03 -07:00 committed by Cheng Zhao
parent 820dab295f
commit b155ebeeb3
3 changed files with 26 additions and 10 deletions

View file

@ -498,17 +498,16 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
it('throws errors from the main process', () => {
expect(() => {
throwFunction()
}).to.throw()
}).to.throw(/undefined/)
})
it('throws custom errors from the main process', () => {
const err = new Error('error')
err.cause = new Error('cause')
err.prop = 'error prop'
it('tracks error cause', () => {
try {
throwFunction(err)
} catch (error) {
expect(error.cause).to.deep.equal(...resolveGetters(err))
throwFunction(new Error('error from main'))
expect.fail()
} catch (e) {
expect(e.message).to.match(/Could not call remote function/)
expect(e.cause.message).to.equal('error from main')
}
})
})