configurationgrunt watch使用requirejs对应用程序运行Jasminetesting

为了提高我的通用编码技能,并学习新的东西。 我已经开始尝试连接仅包含前端的解决scheme

  1. 迪朗达尔
  2. 茉莉花 – [通过npm添加]
  3. Grunt Watch监视和运行我的testing,因为我的代码文件更改 – [通过npm添加]

随时纠正我,因为这是根据我在过去两天的实验。 这大部分对我来说都是新的。 我的目标是有什么angular度与业力相似的东西。

现在我意识到,Durandal项目(在github解决scheme中提供了一个自定义的spec runner)

我的设置:

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时,出现非法的path或脚本错误:['plugins / http'](我已经在屏幕截图中解决了ko问题) 在这里输入图像描述

题:

我将如何去设置我的gruntfile需要任何依赖关系。 我很新,需要,我不知道如何configuration它使我的testing知道在哪里find像第三方库和其他自定义js文件的事情

SpecRunner require.config缺lessDurandal特定的path信息。 如果将baseUrl设置为“App”,则下面的path与HTML示例或StarterKit布局相匹配。 如果你的布局不同,你必须相应地调整。

 requirejs.config({ paths: { 'text': '../lib/require/text', 'durandal':'../lib/durandal/js', 'plugins' : '../lib/durandal/js/plugins', 'transitions' : '../lib/durandal/js/transitions', 'knockout': '../lib/knockout/knockout-2.3.0', 'bootstrap': '../lib/bootstrap/js/bootstrap', 'jquery': '../lib/jquery/jquery-1.9.1' } });