QUnit

QUnit は JavaScript における単体テストを自動化するためのフレームワークであり、クライアントの Web ブラウザ、及び Node…

QUnit
QUnit
開発元 John Resig
最新版
2.24.1 / 2025年1月26日 (18か月前) (2025-01-26)
リポジトリ ウィキデータを編集
プログラミング
言語
JavaScript
種別 単体テストツール
ライセンス GPL, MIT
公式サイト qunitjs.com
テンプレートを表示

QUnitJavaScript における単体テストを自動化するためのフレームワークであり、クライアントWeb ブラウザ、及び Node.js といったサーバーサイドにおけるJavaScript環境[1]のテストに使用できる。

概要

2008年にJohn Resigが jQuery の一部としてドキュメントや各種リソースが公開。2009年にjQueryに依存しない実装に書き換えられた。

クライアントサイドの単体テストにおいては、ボタンのクリック押下や キーダウンといったユーザ アクションの再現、Ajaxで非同期コールバックを行うといった活用ができる。

サンプル

以下に簡単な使用方法を示す:

export default function sum(a, b) {
  return a + b;
}
import sum from './sum.js';

QUnit.test('sum', (assert) => {
  assert.equal(sum(1, 2), 3);
});

脚注

  1. ^ Getting Started - QUnit” (英語). qunitjs.com. 2021年1月12日閲覧。

関連項目

外部リンク

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.