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

Harness primitive for testing expected crashes / uncaught exceptions

オープン
#33 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js
領域
testing-qa

調査の方向性

まず test_exception/testFinalizerException.js と test_fatal を読んで、サブプロセスに対するそれぞれの期待値を比較します。提案された expectCrash の形を中心に、実装者が提供する harness を設計し、stderr のマッチングと、例外またはシグナルに基づく終了を含めます。両方の対象テストで helper を使用でき、期待される crash の結果を引き続き検証できれば完了です。

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

説明

Problem

Several upstream Node.js tests verify behavior that causes the process to exit abnormally — uncaught exceptions from finalizers, fatal errors, etc. These tests use a subprocess pattern:

  1. Spawn a child process that loads the addon and triggers the crash
  2. Assert on the child's exit code and stderr output

The CTS currently has no equivalent harness primitive for this pattern.

Affected tests

  • test_exception/testFinalizerException.js (js-native-api) — finalizer throws during GC, expects process exit with "Error during Finalize" on stderr
  • test_fatal (node-api) — calls napi_fatal_error, expects process abort with specific message

Proposed solution

Add a harness helper that runs a code snippet in a subprocess and asserts on the outcome:

// Possible API shape:
await expectCrash({
  code: () => {
    const addon = loadAddon('test_exception');
    addon.createExternal();
    // trigger GC...
  },
  stderr: /Error during Finalize/,
  exitCode: (code) => code !== 0,
});

Each implementor would provide the subprocess execution mechanism (e.g., Node.js would use child_process.spawnSync).

Considerations

  • The helper needs to be implementor-provided since subprocess APIs are runtime-specific
  • The test code to run in the subprocess may need access to loadAddon and other CTS globals
  • Some crashes are signal-based (SIGABRT from napi_fatal_error) vs exception-based — the helper should handle both
主要言語
C
スター
18
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

nodejs/node-api-cts のほかの issue

nodejs/node-api-cts の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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