> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

> JavaScript または TypeScript で Jest、Mocha、Node.js Test Runner を使い、@auth0/actions NPM パッケージで event および api オブジェクトをモックして Auth0 Actions をユニットテストします。

# Actions のユニットテスト

[`@auth0/actions`](https://www.npmjs.com/package/@auth0/actions) NPM パッケージを使用すると、Actions のユニットテストを記述し、ローカル環境やバージョン管理、CI/CD プロセス上で実行できます。これにより、問題が Auth0 テナントに及ぶ前に検出できます。

<h2 id="how-it-works">
  仕組み
</h2>

インストールとインポートについては、[Actions NPMの仕組み](/docs/ja-jp/customize/actions/npm/write-your-action-using-your-code-editor)に記載されているガイドラインに従ってください。

Actionをユニットテストするには、Action関数が受け取る`event`オブジェクトと`api`オブジェクトをモックする必要があります。これらのモックは`auth0/actions`に含まれるTypeScript定義を使って作成でき、テストが本番環境を正確に反映するようになります。モックの管理や機能の検証には、Jestなどのテストフレームワークが最適です。

<h2 id="examples">
  例
</h2>
