jasmine-nodeスクリプトの適用を含むプロジェクトにrun-tests.jsファイルを追加します。この例では、実動コードはrun-tests.jsファイルと平行なlibフォルダの下にあります。
実行の設定:
File path: run-tests.js
Command line arguments: --coffee spec
実行tests.js
if(!process.env.NODE_ENV) process.env.NODE_ENV = 'test';
var path = require('path');
// find out the current paths
//console.log(require.paths);
// I have ~/.node_modules in there, which did not exist and did a
// ln -s ~/local/lib/node_modules/ ~/.node_modules
// my jasmine-node/cli.js is in
// ~/local/lib/node_modules/jasmine-node/lib/jasmine-node/cli.js
// Add the local lib path to allow the specs to require from there
require.paths.unshift(path.join(__dirname, 'lib'));
require('jasmine-node/lib/jasmine-node/cli.js');
この 'run-tests.js'スクリプトの詳しい使用方法を教えてください。私はこれを試すと、require.pathsが削除されているというエラーが表示されます。この回答を更新し、実際にこのスクリプトを使用してテストを実行する方法の一歩を教えてください。私はパズルのいくつかの重要な部分を欠いています。とても有難い。 –