Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit 7f92735

Browse files
authored
Merge pull request #18 from GetStream/refactor-tests
Refactor tests
2 parents 1c57170 + e9e2c30 commit 7f92735

26 files changed

+1349
-731
lines changed

.eslintrc.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"plugins": [
3+
],
4+
"extends": [
5+
"eslint:recommended"
6+
],
7+
"rules": {
8+
"no-console": 0,
9+
"no-mixed-spaces-and-tabs": 1,
10+
"comma-dangle": 0,
11+
"no-unused-vars": 1,
12+
"linebreak-style": [
13+
2,
14+
"unix"
15+
],
16+
"semi": [
17+
1,
18+
"always"
19+
]
20+
},
21+
"env": {
22+
"es6": false,
23+
"browser": true,
24+
"commonjs": true,
25+
"mocha": true
26+
},
27+
"globals": {
28+
"process": true
29+
},
30+
"ecmaFeatures" : {
31+
"modules": true
32+
},
33+
"parserOptions": {
34+
}
35+
}

.jscsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"preset": "airbnb",
3+
"requirePaddingNewLinesBeforeLineComments": null,
4+
"disallowQuotedKeysInObjects": false,
5+
"disallowMultipleVarDecl": false,
6+
"requireDotNotation": false,
7+
"safeContextKeyword": null,
8+
"validateIndentation": 4,
9+
}

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,19 @@ node_js:
44
- "lts/*"
55
- "8"
66
- "7"
7+
env:
8+
- MONGOOSE_VERSION=4.11 STREAM_URL='https://key:[email protected]/?app_id=42'
9+
matrix:
10+
include:
11+
- node_js: 8
12+
env: MONGOOSE_VERSION=4.0
13+
- node_js: 8
14+
env: MONGOOSE_VERSION=3.6
15+
- node_js: 8
16+
env: MONGOOSE_VERSION=3.0
17+
before_script:
18+
- npm install mongoose@$MONGOOSE_VERSION
19+
script:
20+
- bash ./bin/travis.sh
721
services:
822
- mongodb

CONTRIBUTORS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ Stream-Example-Nodejs
33

44
* **[Mario Delgado](https://github.com/peachepe)**
55

6-
* **[Tommaso Barbugli](https://github.com/tbarbugli)**
6+
* **[Tommaso Barbugli](https://github.com/tbarbugli)**
7+
8+
* **[Thierry Schellenbach](https://github.com/tschellenbach)**
9+
10+
* **[Matthisk Heimensen](https://github.com/matthisk)**

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
[![Build Status](https://travis-ci.org/tbarbugli/stream-node.svg)](https://travis-ci.org/tbarbugli/stream-node)
44
[![npm version](https://badge.fury.io/js/getstream-node.svg)](http://badge.fury.io/js/getstream-node)
5+
[![Coverage Status](https://coveralls.io/repos/github/GetStream/stream-node-orm/badge.svg?branch=refactor-tests)](https://coveralls.io/github/GetStream/stream-node-orm?branch=refactor-tests)
6+
7+
[![NPM](https://nodei.co/npm/getstream-node.png)](https://nodei.co/npm/getstream-node/)
58

69
[stream-node-orm](https://github.com/GetStream/stream-node-orm) is a Node.js (Sails, Waterline) client for [Stream](https://getstream.io/).
710

@@ -292,6 +295,24 @@ streamCustomEnrichment.prototype = {
292295
util.inherits(streamCustomEnrichment, streamNode.mongoose.Backend);
293296
```
294297

298+
### Contributing
299+
300+
Running tests:
301+
302+
```
303+
npm test
304+
```
305+
306+
### Releasing
307+
308+
Make sure your working directory is clean and run:
309+
310+
```
311+
npm install
312+
npm version [ major | minor | patch ]
313+
npm publish
314+
```
315+
=======
295316
### Copyright and License Information
296317

297318
Copyright (c) 2015-2017 Stream.io Inc, and individual contributors. All rights reserved.

bin/coveralls.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
istanbul cover ./bin/run-tests.js --report lcov
4+
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
5+
rm -rf ./coverage

bin/run-tests.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var Mocha = require('mocha')
2+
, glob = require('glob')
3+
, path = require('path');
4+
5+
var mocha = new Mocha({});
6+
7+
var files = glob.sync('../test/**/*_test.js', { cwd: __dirname });
8+
9+
files.forEach(function(file) {
10+
file = path.join(__dirname, file);
11+
mocha.addFile(file);
12+
});
13+
14+
/* istanbul ignore next */
15+
mocha.run(function(failures) {
16+
process.on('exit', function() {
17+
process.exit(failures);
18+
});
19+
20+
process.exit();
21+
});

bin/travis.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
npm test
4+
./bin/coveralls.sh
5+
# ./node_modules/.bin/eslint src/**/*.js;

package.json

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,24 @@
33
"version": "1.4.1",
44
"description": "Build newsfeeds and activity feeds on node.js using getstream.io",
55
"author": "getstream.io <[email protected]> (https://getstream.io/)",
6+
"email": "[email protected]",
7+
"company": "Stream.io INC",
68
"contributors": [
79
{
810
"name": "Mario Delgado",
911
"email": "[email protected]"
1012
},
1113
{
1214
"name": "Thierry Schellenbach",
13-
"email": "[email protected]"
15+
"email": "[email protected]"
16+
},
17+
{
18+
"name": "Tommaso Barbugli",
19+
"email": "[email protected]"
20+
},
21+
{
22+
"name": "Matthisk Heimensen",
23+
"email": "[email protected]"
1424
},
1525
{
1626
"name": "Nick Parsons",
@@ -29,19 +39,28 @@
2939
"sinon": ">=3.2.1"
3040
},
3141
"devDependencies": {
32-
"mongoose": ">=4.11.8",
33-
"bson": ">=1.0.4",
34-
"mocha": ">=3.5.0",
35-
"should": ">=11.2.1",
36-
"better-assert": ">=1.0.2"
42+
"better-assert": "~1.0.0",
43+
"bson": "~0.5.4",
44+
"coveralls": "~2.11.14",
45+
"eslint": "~3.7.1",
46+
"expect.js": "~0.3.1",
47+
"glob": "~7.1.1",
48+
"jscs": "~3.0.7",
49+
"mocha": "~3.1.0",
50+
"mock-fs": "~3.11.0",
51+
"pmock": "~0.2.3",
52+
"rewire": "~2.5.2",
53+
"should": "~4.0.0",
54+
"mongoose": ">=4.11.8"
3755
},
3856
"scripts": {
39-
"test": "STREAM_URL='https://key:[email protected]/?app_id=42' NODE_ENV=test ./node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test",
57+
"test": "STREAM_URL='https://key:[email protected]/?app_id=42' NODE_ENV=test ./node_modules/.bin/mocha test test/**/*_test.js",
58+
"coverage": "STREAM_URL='https://key:[email protected]/?app_id=42' ./node_modules/.bin/istanbul cover bin/run-tests.js",
4059
"preversion": "npm test",
4160
"postversion": "git push && git push --tags"
4261
},
4362
"engines": {
44-
"node": ">=0.6.19"
63+
"node": ">=0.11 <=8.4"
4564
},
4665
"homepage": "http://getstream.io"
4766
}

0 commit comments

Comments
 (0)