浏览代码

Add testing framework

Lily Carpenter 10 年之前
父节点
当前提交
8d2f38156f
共有 4 个文件被更改,包括 78 次插入2 次删除
  1. 2 1
      bower.json
  2. 68 0
      karma.conf.js
  3. 6 1
      package.json
  4. 2 0
      tests/controllerSpec.js

+ 2 - 1
bower.json

@@ -10,6 +10,7 @@
10 10
   "private": true,
11 11
   "dependencies": {
12 12
     "bootstrap": "~3.3.0",
13
-    "angular": "~1.3.2"
13
+    "angular": "~1.3.2",
14
+    "angular-mocks": "~1.3.2"
14 15
   }
15 16
 }

+ 68 - 0
karma.conf.js

@@ -0,0 +1,68 @@
1
+// Karma configuration
2
+// Generated on Tue Nov 11 2014 10:25:19 GMT-0600 (CST)
3
+
4
+module.exports = function(config) {
5
+  config.set({
6
+
7
+    // base path that will be used to resolve all patterns (eg. files, exclude)
8
+    basePath: '',
9
+
10
+
11
+    // frameworks to use
12
+    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13
+    frameworks: ['jasmine'],
14
+
15
+
16
+    // list of files / patterns to load in the browser
17
+    files: [
18
+      'www/lib/angular/angular.js',
19
+      'www/lib/angular-mocks/angular-mocks.js',
20
+      'www/js/**/*.js',
21
+      'tests/**/*.js'
22
+    ],
23
+
24
+
25
+    // list of files to exclude
26
+    exclude: [
27
+    ],
28
+
29
+
30
+    // preprocess matching files before serving them to the browser
31
+    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
32
+    preprocessors: {
33
+    },
34
+
35
+
36
+    // test results reporter to use
37
+    // possible values: 'dots', 'progress'
38
+    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
39
+    reporters: ['progress'],
40
+
41
+
42
+    // web server port
43
+    port: 9876,
44
+
45
+
46
+    // enable / disable colors in the output (reporters and logs)
47
+    colors: true,
48
+
49
+
50
+    // level of logging
51
+    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
52
+    logLevel: config.LOG_INFO,
53
+
54
+
55
+    // enable / disable watching file and executing tests whenever any file changes
56
+    autoWatch: true,
57
+
58
+
59
+    // start these browsers
60
+    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
61
+    browsers: ['Chrome'],
62
+
63
+
64
+    // Continuous Integration mode
65
+    // if true, Karma captures browsers, runs the tests and exits
66
+    singleRun: false
67
+  });
68
+};

+ 6 - 1
package.json

@@ -21,6 +21,11 @@
21 21
     "gulp": "^3.8.10",
22 22
     "gulp-connect": "^2.2.0",
23 23
     "gulp-plumber": "^0.6.6",
24
-    "gulp-watch": "^1.1.0"
24
+    "gulp-watch": "^1.1.0",
25
+    "karma": "^0.12.24"
26
+  },
27
+  "devDependencies": {
28
+    "karma-chrome-launcher": "^0.1.5",
29
+    "karma-jasmine": "^0.2.3"
25 30
   }
26 31
 }

+ 2 - 0
tests/controllerSpec.js

@@ -0,0 +1,2 @@
1
+describe('My notes controller', function(){
2
+});