caolan / caolan/nodeunit

How to export function from module without nodeunit testing it?

オープン
#353 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
1.9k
フォーク
359
PR マージ指標
30日以内にマージされた PR はありません

説明

I've got a few tests scattered throughout multiple files.

Currently I just run `nodeunit .`, nodeunit then tests them all successfully. Great!

But I want to export a function from one of my files so that another can call it. The problem is that when I run `nodeunit .` that function now gets called.

How can I run tests on all files? I'm used to python's `nose` library, which only tests functions that have `test` in the function name.

Do I need to move all tests into a seperate file to the functionality? I don't want to do that. I like putting tests adjacent to the code they're testing.

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

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、`nodeunit .` コマンド周辺における nodeunit のテスト検出とモジュール読み込みの動作を読んでください。この issue ではソースファイルやテストは指定されていません。エクスポートされた関数がどのように扱われるかを、望ましい隣接テストのレイアウトと比較してください。完了の条件は、再利用のためにエクスポートされたヘルパー関数を呼び出すことなく、意図したすべてのテストが引き続き実行されることです。

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

評価

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

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

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