【发布时间】:2013-10-10 18:01:25
【问题描述】:
为了提高我的一般编码技能......并学习新东西。 我已经开始尝试连接由
组成的仅前端解决方案- 杜兰达尔
- 茉莉花 - [通过 npm 添加]
- Grunt Watch 在我的代码文件更改时监控和运行我的测试 - [通过 npm 添加]
请随时纠正我,因为这一切都是基于我过去 2 天的实验。其中大部分对我来说都是新的。我的目标是拥有类似于 Angular 与业力的东西。
现在我知道 Durandal 项目(带有自定义规范运行器,如 github 解决方案中所示)
我的设置:
gruntfile.js
module.exports = function(grunt) {
var appPath = 'App/viewmodels/*.js';
var testPath = 'Tests/**/*.js';
grunt.initConfig({
jasmine: {
pivotal: {
src: appPath,
options: {
specs: testPath,
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfigFile: 'SpecRunner.js'
}
}
}
},
jshint: {
all: [testPath, appPath],
options: {
curly: true
}
},
watch: {
files: [testPath, appPath],
tasks: ['jshint','jasmine']
}
});
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint','jasmine']);
};
SpecRunner.js
require.config({
paths: {
jquery: 'Scripts/jquery-1.9.1',
knockout: 'Scripts/knockout-2.3.0'
},
shim: {
knockout: {
exports: "ko"
}
}
});
当我运行 grunt 时,我得到一个非法路径或脚本错误:['plugins/http'] (截图中的ko问题我已经整理好了)
问题:
我将如何设置我的 gruntfile 以要求任何依赖项。我很陌生,我不确定如何配置它以使我的测试知道在哪里可以找到诸如 3rd 方库和其他自定义 js 文件之类的东西
【问题讨论】:
标签: node.js requirejs durandal grunt-contrib-watch