Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 7e983d1

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(test): fix #1155, try/catch modify error.message (#1157)
1 parent 0b44e83 commit 7e983d1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Diff for: lib/jasmine/jasmine.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@
250250
const proxyZoneSpec: any = this && this.testProxyZoneSpec;
251251
if (proxyZoneSpec) {
252252
const pendingTasksInfo = proxyZoneSpec.getAndClearPendingTasksInfo();
253-
error.message += pendingTasksInfo;
253+
try {
254+
// try catch here in case error.message is not writable
255+
error.message += pendingTasksInfo;
256+
} catch (err) {
257+
}
254258
}
255259
}
256260
if (onException) {

Diff for: lib/mocha/mocha.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@
164164
this.on('fail', (test: any, err: any) => {
165165
const proxyZoneSpec = testZone && testZone.get('ProxyZoneSpec');
166166
if (proxyZoneSpec && err) {
167-
err.message += proxyZoneSpec.getAndClearPendingTasksInfo();
167+
try {
168+
// try catch here in case err.message is not writable
169+
err.message += proxyZoneSpec.getAndClearPendingTasksInfo();
170+
} catch (error) {
171+
}
168172
}
169173
});
170174

0 commit comments

Comments
 (0)