Skip to content

Commit 5c431da

Browse files
committed
feat(zone.js): jest 29 should ignore uncaught error console log
Close angular#49110 From jest 29 and jest-preset-angular v13, the module transform logic changed, and now jest-preset-angular use the use the tsconfig target other than the hardcoded one, thymikee/jest-preset-angular#2010 But jest-angular-preset doesn't introduce the @babel/plugin-transform-async-to-generator which is needed by angular since `async/await` still need to be transformed to promise for ES2017+ target. So for now, we disable to output the uncaught error console log for a temp solution, until jest-preset-angular find a proper solution.
1 parent 2dbf3e0 commit 5c431da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: packages/zone.js/lib/jest/jest.ts

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ Zone.__load_patch('jest', (context: any, Zone: ZoneType, api: _ZonePrivate) => {
1313
return;
1414
}
1515

16+
17+
// From jest 29 and jest-preset-angular v13, the module transform logic
18+
// changed, and now jest-preset-angular use the use the tsconfig target
19+
// other than the hardcoded one, https://github.com/thymikee/jest-preset-angular/issues/2010
20+
// But jest-angular-preset doesn't introduce the @babel/plugin-transform-async-to-generator
21+
// which is needed by angular since `async/await` still need to be transformed
22+
// to promise for ES2017+ target.
23+
// So for now, we disable to output the uncaught error console log for a temp solution,
24+
// until jest-preset-angular find a proper solution.
25+
(Zone as any)[api.symbol('ignoreConsoleErrorUncaughtError')] = true;
1626
jest['__zone_patch__'] = true;
1727

1828
const ProxyZoneSpec = (Zone as any)['ProxyZoneSpec'];

0 commit comments

Comments
 (0)