Skip to content

Commit 6a569e9

Browse files
committed
[minor] minor adjustments to pull request 3rd-Eden#65 and started on travis-ci integration
1 parent 6070ef4 commit 6a569e9

11 files changed

+44
-22
lines changed

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Makefile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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')
42

53
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)
125

6+
travis:
7+
MEMCACHED__HOST=localhost $(MAKE) test
138
doc:
149
dox --title "node-memcached" lib/* > doc/index.html
1510

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
, "should": "*"
4343
}
4444
, "scripts": {
45-
"test": "./node_modules/.bin/mocha tests/"
45+
"test": "./node_modules/.bin/mocha $(shell find test -name '*.test.js')"
4646
}
4747
}

tests/common.js renamed to test/common.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
2-
/**
3-
* Make should available in all test cases.
4-
*/
5-
var should = require('should');
1+
'use strict';
62

73
/**
84
* Server ip addresses that get used during the tests
95
* NOTE! Make sure you configure empty servers as they
106
* will get flushed!.
11-
*
7+
*
128
* If your memcache hosts is not the default one
139
* (10.211.55.5), you can pass another one using the
1410
* environment variable MEMCACHED__HOST. E.g.:
15-
*
11+
*
1612
* MEMCACHED__HOST=localhost npm test
1713
*
1814
* @type {Object}
1915
* @api public
2016
*/
21-
var testMemcachedHost = process.env['MEMCACHED__HOST'] || '10.211.55.5';
17+
var testMemcachedHost = process.env.MEMCACHED__HOST || '10.211.55.5';
18+
2219
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+
]
2526
};
2627

2728
/**
@@ -31,15 +32,22 @@ exports.servers = {
3132
* @returns {String} a random generated string
3233
* @api public
3334
*/
34-
exports.alphabet = function(n){
35+
exports.alphabet = function alphabet(n){
3536
for (var a = '', i = 0; i < n; i++) {
3637
a += String.fromCharCode(97 + Math.floor(Math.random() * 26));
3738
}
3839

3940
return a;
4041
};
4142

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){
4351
for (var a = 0, i = 0; i < n; i++) {
4452
a += Math.floor(Math.random() * 26);
4553
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)