作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我经常使用 Jasmine(JavaScript 的 BDD)并且刚刚发现 Cloud9 并想尝试一下。
在我的本地机器上,我使用 jasmine-node 来运行我的规范,但我不知道如何在 Cloud9 中执行此操作。我能够使用 Cloud9 编辑器底部的控制台栏通过 npm 以某种方式安装 jasmine-node,但我无法使用它。
我用 CoffeeScript 编写代码,但这应该不是问题,我也试过 JavaScript。
最佳答案
将 run-tests.js 文件添加到包含 jasmine-node 脚本改编的项目。在此示例中,生产代码位于与 run-tests.js 文件平行的 lib 文件夹下。
运行配置:
File path: run-tests.js
Command line arguments: --coffee spec
运行测试.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');
关于jasmine - 如何在 Cloud9 中使用 Jasmine?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7450568/
我是一名优秀的程序员,十分优秀!