Skip to content
This repository
Browse code

[minor] minor adjustments to pull request #65 and started on travis-c…

…i integration
  • Loading branch information...
commit 6a569e9bd13a90b40f69606cb0d187429e27a202 1 parent 6070ef4
Arnout Kazemier authored October 20, 2012
16  .travis.yml
... ...
@@ -0,0 +1,16 @@
  1
+# ensure that we only run ci test on the Node.js enabled servers
  2
+language: node_js
  3
+node_js:
  4
+  - 0.8
  5
+
  6
+# create a travis enabled environment for the test suite to run in
  7
+script: "make travisci"
  8
+services: memcache
  9
+
  10
+# the `sevices: memcache` will start a memcached service on localhost
  11
+# and on the default port, but in order to test against multiple memcache
  12
+# instances we need to spawn a couple more, so we do that during the before
  13
+# script
  14
+before_script:
  15
+  - memcached -p 11212 -h 127.0.0.1 -d
  16
+  - memcached -p 11213 -h 127.0.0.1 -d
13  Makefile
... ...
@@ -1,15 +1,10 @@
1  
-ALL_TESTS = $(shell find tests -name '*.test.js')
2  
-REPORTER = spec
3  
-UI = bdd
  1
+ALL_TESTS = $(shell find test -name '*.test.js')
4 2
 
5 3
 test:
6  
-	@./node_modules/.bin/mocha \
7  
-		--require should \
8  
-		--reporter $(REPORTER) \
9  
-		--ui $(UI) \
10  
-		--growl \
11  
-		$(ALL_TESTS)
  4
+	@./node_modules/.bin/mocha $(ALL_TESTS)
12 5
 
  6
+travis:
  7
+	MEMCACHED__HOST=localhost $(MAKE) test
13 8
 doc:
14 9
 	dox --title "node-memcached" lib/* > doc/index.html
15 10
 
2  package.json
@@ -42,6 +42,6 @@
42 42
       , "should": "*"
43 43
     }
44 44
   , "scripts": {
45  
-      "test": "./node_modules/.bin/mocha tests/"
  45
+      "test": "./node_modules/.bin/mocha $(shell find test -name '*.test.js')"
46 46
     }
47 47
 }
32  tests/common.js → test/common.js
... ...
@@ -1,27 +1,28 @@
1  
-
2  
-/**
3  
- * Make should available in all test cases.
4  
- */
5  
-var should = require('should');
  1
+'use strict';
6 2
 
7 3
 /**
8 4
  * Server ip addresses that get used during the tests
9 5
  * NOTE! Make sure you configure empty servers as they
10 6
  * will get flushed!.
11  
- * 
  7
+ *
12 8
  * If your memcache hosts is not the default one
13 9
  * (10.211.55.5), you can pass another one using the
14 10
  * environment variable MEMCACHED__HOST. E.g.:
15  
- * 
  11
+ *
16 12
  * MEMCACHED__HOST=localhost npm test
17 13
  *
18 14
  * @type {Object}
19 15
  * @api public
20 16
  */
21  
-var testMemcachedHost = process.env['MEMCACHED__HOST'] || '10.211.55.5';
  17
+var testMemcachedHost = process.env.MEMCACHED__HOST || '10.211.55.5';
  18
+
22 19
 exports.servers = {
23  
-  single: testMemcachedHost + ':11211'
24  
-, multi: [testMemcachedHost + ':11211', testMemcachedHost + ':11212', testMemcachedHost + ':11213']
  20
+    single: testMemcachedHost + ':11211'
  21
+  , multi: [
  22
+      testMemcachedHost + ':11211'
  23
+    , testMemcachedHost + ':11212'
  24
+    , testMemcachedHost + ':11213'
  25
+  ]
25 26
 };
26 27
 
27 28
 /**
@@ -31,7 +32,7 @@ exports.servers = {
31 32
  * @returns {String} a random generated string
32 33
  * @api public
33 34
  */
34  
-exports.alphabet = function(n){
  35
+exports.alphabet = function alphabet(n){
35 36
   for (var a = '', i = 0; i < n; i++) {
36 37
     a += String.fromCharCode(97 + Math.floor(Math.random() * 26));
37 38
   }
@@ -39,7 +40,14 @@ exports.alphabet = function(n){
39 40
   return a;
40 41
 };
41 42
 
42  
-exports.numbers = function(n){
  43
+/**
  44
+ * Generate a bunch of random numbers
  45
+ *
  46
+ * @param {Number} n the amount of numbers
  47
+ * @returns {Number}
  48
+ * @api public
  49
+ */
  50
+exports.numbers = function numbers(n){
43 51
   for (var a = 0, i = 0; i < n; i++) {
44 52
     a += Math.floor(Math.random() * 26);
45 53
   }
0  tests/fixtures/hotchicks.jpg → test/fixtures/hotchicks.jpg
File renamed without changes
0  tests/fixtures/lipsum.txt → test/fixtures/lipsum.txt
File renamed without changes
0  tests/memcached-add.test.js → test/memcached-add.test.js
File renamed without changes
0  tests/memcached-cas.test.js → test/memcached-cas.test.js
File renamed without changes
0  tests/memcached-get-set.test.js → test/memcached-get-set.test.js
File renamed without changes
0  tests/memcached-incr-decr.test.js → test/memcached-incr-decr.test.js
File renamed without changes
3  test/mocha.opts
... ...
@@ -0,0 +1,3 @@
  1
+--require should
  2
+--reporter spec
  3
+--ui bdd

0 notes on commit 6a569e9

Please sign in to comment.
Something went wrong with that request. Please try again.