Skip to content

Commit

Permalink
- update readme, trigger travis
Browse files Browse the repository at this point in the history
- clean up make file, set timeouts for integration tests
  • Loading branch information
DonutEspresso committed Jun 30, 2015
1 parent 284158e commit 508e296
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
@@ -0,0 +1,6 @@
language: node_js
node_js:
- 0.10
- 0.11
- 0.12
after_success: 'make report-coverage'
38 changes: 21 additions & 17 deletions Makefile
@@ -1,7 +1,8 @@
#
# Directories
#
NODE_MODULES := './node_modules'
ROOT := $(shell pwd)
NODE_MODULES := $(ROOT)/node_modules
NODE_BIN := $(NODE_MODULES)/.bin


Expand All @@ -22,23 +23,26 @@ NPM := npm
#
GIT_HOOK_SRC = '../../tools/githooks/pre-push'
GIT_HOOK_DEST = '.git/hooks/pre-push'
LIB_FILES = './lib'
TEST_FILES = './test'
COVERAGE_FILES = './coverage'
LCOV = './coverage/lcov.info'
LIB_FILES := $(ROOT)/lib
TEST_FILES := $(ROOT)/test
COVERAGE_FILES := $(ROOT)/coverage
LCOV := $(ROOT)/coverage/lcov.info

# src is everything except node_modules and the example dir
SRCS := $(shell find $(LIB_FILES) $(TEST_FILES) -name '*.js' -type f \
-not \( -path "./node_modules/*" -prune \) \
-not \( -path "./example/*" -prune \))

#
# Targets
#

.PHONY: all
all: node_modules lint codestyle test clean-coverage
all: clean node_modules lint codestyle test


node_modules: package.json
$(NPM) install
# must always touch node_modules, because npm doesn't update timestamp.
@touch $(NODE_MODULES)


Expand All @@ -48,36 +52,36 @@ githooks:


.PHONY: lint
lint: node_modules
$(ESLINT) $(LIB_FILES) $(TEST_FILES)
lint: node_modules $(ESLINT) $(SRCS)
$(ESLINT) $(SRCS)


.PHONY: codestyle
codestyle: node_modules
$(JSCS) $(LIB_FILES) $(TEST_FILES)
codestyle: node_modules $(JSCS) $(SRCS)
$(JSCS) $(SRCS)


.PHONY: codestyle-fix
codestyle-fix: node_modules
$(JSCS) $(LIB_FILES) $(TEST_FILES) --fix
codestyle-fix: node_modules $(JSCS) $(SRCS)
$(JSCS) $(SRCS) --fix


.PHONY: prepush
prepush: node_modules lint codestyle test


.PHONY: test
test: node_modules
test: node_modules $(MOCHA) $(SRCS)
$(MOCHA) -R spec


.PHONY: coverage
coverage: node_modules clean-coverage
coverage: node_modules $(ISTANBUL) $(SRCS)
$(ISTANBUL) cover $(_MOCHA) --report lcovonly -- -R spec


.PHONY: report-coverage
report: coverage
report-coverage: coverage
@cat $(LCOV) | $(COVERALLS)


Expand All @@ -94,4 +98,4 @@ clean: clean-coverage
#
## Debug -- print out a a variable via `make print-FOO`
#
#print-% : ; @echo $* = $($*)
print-% : ; @echo $* = $($*)
16 changes: 12 additions & 4 deletions README.md
Expand Up @@ -452,20 +452,28 @@ _(Coming soon)_

## Contributing

Add unit tests for any new or changed functionality. Ensure that ESLint passes.
Add unit tests for any new or changed functionality. Ensure that lint and style
checks pass.

To start contributing, install the git pre-push hooks:
To start contributing, install the git preush hooks:

```sh
npm run githook
make githooks
```

Before committing, run the prepush hook:

```sh
npm run prepush
make prepush
```

If you have style errors, you can auto fix whitespace issues by running:

```sh
make codestyle-fix
```


## License

Copyright (c) 2015 Netflix, Inc.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -30,8 +30,9 @@
},
"devDependencies": {
"chai": "^3.0.0",
"coveralls": "^2.11.2",
"eslint": "^0.24.0",
"istanbul": "^0.3.16",
"istanbul": "^0.3.17",
"jscs": "^1.13.1",
"mocha": "^2.2.5",
"sinon": "^1.15.3"
Expand Down
4 changes: 4 additions & 0 deletions test/IntegrationSpec.js
Expand Up @@ -118,6 +118,8 @@ describe('Integration tests using the demo app', function() {
});

it('should return remote models', function(done) {
this.timeout(10000);

client.get('/model3?userId=2', function(err, req, res, data) {
assert.ifError(err);

Expand Down Expand Up @@ -147,6 +149,8 @@ describe('Integration tests using the demo app', function() {
});

it('should fetch two async models in series', function(done) {
this.timeout(10000);

client.get('/model5?text=helloworld', function(err, req, res, data) {
assert.ifError(err);

Expand Down

0 comments on commit 508e296

Please sign in to comment.