Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

vite: async/await is not lowered for zone.js, so fakeAsync/tick cannot control awaits

クローズ
#641 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@edbzn がすでに取り組んでいます。

2026年10月25日 から。

  • #642 @edbzn による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, javascript, typescript, vite

調査の方向性

Start by reading #607’s transformForBrowser and lowerAsync, then inspect the Vite plugin transform path described in the issue. Reproduce the failure with the supplied zone.js and TestBed example, and check whether lowering async functions restores flushMicrotasks() behavior. Done means the test passes with the plugin’s chosen zone.js handling; an open linked pull request #642 shows work is already underway.

索引モデルが issue の本文から書いたものです。

説明

Summary

@oxc-angular/vite leaves async/await native. zone.js can't patch native await, so in a zone-based app (and in zone-based tests) fakeAsync + tick()/flushMicrotasks() no longer drive code that awaits, and change detection after an await relies on the native promise instead of a zone task. The Angular CLI (esbuild supported: { 'async-await': false } when zone.js is in the polyfills) and Analog (supportedBrowsers → Angular's JavaScriptTransformer) both lower async to generators for this reason.

We hit it moving ~160 Vitest projects from @analogjs/vite-plugin-angular to @oxc-angular/vite: specs like the one below started failing.

Reproduction

// service.ts
@Injectable({ providedIn: 'root' })
export class AuthService {
  constructor(private cognito: Cognito) {}
  async logout() {
    await this.cognito.signOutRedirectUrl();
    await this.cognito.signOut();
  }
}

// service.spec.ts (zone.js + TestBed)
it('signs out', fakeAsync(() => {
  service.logout();
  flushMicrotasks();
  expect(cognito.signOut).toHaveBeenCalled(); // fails with @oxc-angular/vite, passes with Analog / Angular CLI
}));
Actual

signOut is never called inside the fakeAsync zone: the second await resumes on a native microtask the zone doesn't track.

Expected (Angular CLI / Analog)

async functions are emitted as generators (__async(this, null, function* () { ... })), so flushMicrotasks() runs both awaits and the assertion passes.

Notes

  • #607 adds transformForBrowser with exactly this lowering (lowerAsync), but the Vite plugin doesn't call it. Wiring it into the plugin's transform when zone.js is in use (or behind an option) would close this.
  • Workaround today: Vite esbuild: { supported: { 'async-await': false } }. Under Vitest it also needs esbuild's var __async helper rewritten to a function declaration, because vi.mock hoisting moves async mock factories above it (__async is not a function).
主要言語
Rust
スター
244
フォーク
26
平均マージ
1日 57分
マージ済み PR(30日)
103

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/oxc-angular-compiler のほかの issue

voidzero-dev/oxc-angular-compiler の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。