From 3c7a12f64e9d8523edb2a3faac2358efe7df3677 Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 11 May 2017 10:04:29 -0700 Subject: [PATCH 1/6] Create basic README.md --- README.md | 3 +++ package.json | 1 + 2 files changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..829d7df --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# node-examples + +![alt text](https://api.travis-ci.org/pbbadenhorst/node-examples.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file diff --git a/package.json b/package.json index eb99cec..d024632 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "app\\server.js", "dependencies": {}, "devDependencies": { + "coveralls": "^2.13.1", "jasmine": "^2.6.0" }, "scripts": { From 70e390a6ea0adbe54b289e4ba49e3424611b093b Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 11 May 2017 14:18:14 -0700 Subject: [PATCH 2/6] Addtional CI changes (including coveralls integations and README.md badges) --- .gitignore | 10 ++++++++-- .travis.yml | 4 +++- README.md | 2 +- package.json | 8 ++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 581b6a7..aac6195 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,11 @@ Network Trash Folder Temporary Items .apdisk -# Node files -node_modules \ No newline at end of file +# Node dev files +node_modules + +# Node debug.log files +npm-debug.log + +# Coverage files +coverage \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9f3aec6..8cc5042 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: node_js node_js: - "iojs" - - "7" \ No newline at end of file + - "7" +after_success: + - npm run report-coverage \ No newline at end of file diff --git a/README.md b/README.md index 829d7df..4b1ad0c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # node-examples -![alt text](https://api.travis-ci.org/pbbadenhorst/node-examples.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file +[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file diff --git a/package.json b/package.json index d024632..d10f0d8 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,17 @@ "dependencies": {}, "devDependencies": { "coveralls": "^2.13.1", + "istanbul": "^0.4.5", "jasmine": "^2.6.0" }, "scripts": { "vanilla-jasmine": "node vanilla-jasmine/src/index.js", - "vanilla-jasmine-test": "node vanilla-jasmine/spec/index.js", + "vanilla-jasmine-test": "istanbul cover vanilla-jasmine/spec/index.js", + "vanilla-jasmine-coverage": "istanbul cover vanilla-jasmine/spec/index.js", + "report-coverage": "cat ./coverage/lcov.info | coveralls", "start": "npm run vanilla-jasmine", - "test": "npm run vanilla-jasmine-test" + "test": "npm run vanilla-jasmine-test", + "coverage": "npm run vanilla-jasmine-coverage" }, "repository": { "type": "git", From 24850a6be9669a34914ad238f9c4b92709d27b92 Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 25 May 2017 14:17:49 -0700 Subject: [PATCH 3/6] Adding circle ci --- README.md | 6 +- .../.vscode/launch.json | 22 ++++++ express-testing-with-mocha-chai/app/server.js | 10 +++ express-testing-with-mocha-chai/package.json | 26 +++++++ .../test/server.test.js | 21 ++++++ vanilla-basic-auth/src/index.js | 7 ++ vanilla-basic-auth/test/index.test.js | 1 + vanilla-jasmine/spec/helpers/agent.js | 45 ++++++------ vanilla-jasmine/spec/index.spec.js | 69 +++++++------------ 9 files changed, 142 insertions(+), 65 deletions(-) create mode 100644 express-testing-with-mocha-chai/.vscode/launch.json create mode 100644 express-testing-with-mocha-chai/app/server.js create mode 100644 express-testing-with-mocha-chai/package.json create mode 100644 express-testing-with-mocha-chai/test/server.test.js create mode 100644 vanilla-basic-auth/src/index.js create mode 100644 vanilla-basic-auth/test/index.test.js diff --git a/README.md b/README.md index 4b1ad0c..d9e55d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # node-examples -[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file +[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) +[![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) + +[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=shield)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) +[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=svg)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) diff --git a/express-testing-with-mocha-chai/.vscode/launch.json b/express-testing-with-mocha-chai/.vscode/launch.json new file mode 100644 index 0000000..102667c --- /dev/null +++ b/express-testing-with-mocha-chai/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + // { + // "type": "node", + // "request": "launch", + // "name": "Launch Program", + // "program": "${workspaceRoot}\\app\\server.js" + // }, + { + "name": "Debug Mocha Test", + "request": "launch", + "type": "node", + "address": "localhost", + "port": 5858, + "sourceMaps": false + } + ] +} \ No newline at end of file diff --git a/express-testing-with-mocha-chai/app/server.js b/express-testing-with-mocha-chai/app/server.js new file mode 100644 index 0000000..b78b60b --- /dev/null +++ b/express-testing-with-mocha-chai/app/server.js @@ -0,0 +1,10 @@ +var express = require('express'); +var app = new express(); + +app.get('/', function(req, res) { + res.send('Hello World'); +}); + +app.listen(process.env.PORT || 3100); + +module.exports = app \ No newline at end of file diff --git a/express-testing-with-mocha-chai/package.json b/express-testing-with-mocha-chai/package.json new file mode 100644 index 0000000..8422450 --- /dev/null +++ b/express-testing-with-mocha-chai/package.json @@ -0,0 +1,26 @@ +{ + "name": "express-testing-with-mocha-chai", + "version": "1.0.0", + "description": "Example of a express server with mocha and chai", + "main": "app\\server.js", + "scripts": { + "start": "node app\\server.js", + "test": "mocha --debug-brk" + }, + "keywords": [ + "Express", + "BDD", + "Mocha", + "Chai" + ], + "author": "Bernard Badenhorst", + "license": "ISC", + "dependencies": { + "express": "^4.15.2" + }, + "devDependencies": { + "chai": "^3.5.0", + "chai-http": "^3.0.0", + "mocha": "^3.3.0" + } +} \ No newline at end of file diff --git a/express-testing-with-mocha-chai/test/server.test.js b/express-testing-with-mocha-chai/test/server.test.js new file mode 100644 index 0000000..b5a6578 --- /dev/null +++ b/express-testing-with-mocha-chai/test/server.test.js @@ -0,0 +1,21 @@ +var chai = require('chai'); +var chaiHttp = require('chai-http'); +var app = require('../app/server'); + +var expect = chai.expect; + +chai.use(chaiHttp); + +describe('App', function() { + describe('GET /', function() { + it('Responds with status 200 and "Hello World"', function(done) { + chai.request(app) + .get('/') + .end(function(err, res) { + expect(res).to.have.status(200); + + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/vanilla-basic-auth/src/index.js b/vanilla-basic-auth/src/index.js new file mode 100644 index 0000000..1f9b159 --- /dev/null +++ b/vanilla-basic-auth/src/index.js @@ -0,0 +1,7 @@ +var http = require('http'); +var port = process.env.PORT || 3000; + +var server = http.createServer(function (req, res) { + res.writeHead(200); + res.end('Hello world'); +}).listen(port, function () { console.log('server listening on port %s', port)}); \ No newline at end of file diff --git a/vanilla-basic-auth/test/index.test.js b/vanilla-basic-auth/test/index.test.js new file mode 100644 index 0000000..3c07346 --- /dev/null +++ b/vanilla-basic-auth/test/index.test.js @@ -0,0 +1 @@ +var assert = require('assert'); diff --git a/vanilla-jasmine/spec/helpers/agent.js b/vanilla-jasmine/spec/helpers/agent.js index e590a31..f968a82 100644 --- a/vanilla-jasmine/spec/helpers/agent.js +++ b/vanilla-jasmine/spec/helpers/agent.js @@ -57,29 +57,34 @@ request = function(options) { }; -var Agent = function(server) { - - var agent = this; - agent._server = server; - var address = server.address(); - agent._port = address.port; - agent._host = address.hostname || address.address; +var Agent = function(options) { + + var self = this; + self.options = options || {}; + self.options.port = options.port || 80; + self.options.host = options.host || options.hostname || options.address || ''; - // Handle unspecified ip addresses (default to localhost) - if (agent._host === '::' || agent._host === '0.0.0.0') - agent._host = 'localhost'; - - agent.get = function(path, options) { - var opt = options || {}; - opt.method = 'GET'; - opt.path = path; - opt.host = agent._host; - opt.port = agent._port; - - return request(opt); + // Handle blank and unspecified ip addresses (default to localhost) + var map = { + '': 'localhost', + '::': 'localhost', + '0.0.0.0': 'localhost' + }; + if (map[self.options.host]) { + self.options.host = map[self.options.host]; + } + + self.get = function(path, options) { + options = options || {}; + options.method = 'GET'; + options.path = path; + options.host = self.options.host; + options.port = self.options.port; + + return request(options); } - return agent; + return self; }; module.exports = Agent; diff --git a/vanilla-jasmine/spec/index.spec.js b/vanilla-jasmine/spec/index.spec.js index 5082b4e..9f7fae3 100644 --- a/vanilla-jasmine/spec/index.spec.js +++ b/vanilla-jasmine/spec/index.spec.js @@ -1,53 +1,34 @@ +var coveralls = require('coveralls'); var jasmine = require('jasmine'); -var server = require('../src'); -var Agent = require('./helpers/agent'); -var agent = new Agent(server); describe('Hello World Server', function () { - describe('GET /', function () { - it('returns with status code 200 and "Hello World" (text/plain)', function (done) { - agent.get('/') - .then(function (response) { - expect(response.statusCode).toBe(200); - expect(response.body).toBe('Hello World'); - expect(response.headers['content-type']).toBe('text/plain'); - done(); - }); - }); - it('returns with status code 200', function (done) { - agent.get('/') - .then(function (response) { - expect(response.statusCode).toBe(200); - done(); - }); - }); + describe('Server is not running', function() { - it('returns with body "Hello World"', function (done) { - agent.get('/') - .then(function (response) { - expect(response.body).toBe('Hello World'); - done(); - }); - }); + }); - it('returns with content type "text/plain"', function (done) { - agent.get('/') - .then(function (response) { - expect(response.headers['content-type']).toBe('text/plain'); - done(); - }); - }); + console.log('Start server before running specs.'); + var server = require('../src'); + console.log('Create agent for testing server.'); + var Agent = require('./helpers/agent'); + var agent = new Agent(server.address()); - }); -}); + afterAll(function(){ + console.log('\nClose server after running specs.'); + server.close(function() { + console.log('Closed server.'); + }); + }); -beforeAll(function() { - -}); - -afterAll(function(){ - server.close(function() { - console.log('\n\nClosed server after running specs.'); - }); + describe('GET /', function () { + it('returns with status code 200 and "Hello World" (text/plain)', function (done) { + agent.get('/') + .then(function (response) { + expect(response.statusCode).toBe(200); + expect(response.body).toBe('Hello World'); + expect(response.headers['content-type']).toBe('text/plain'); + done(); + }); + }); + }); }); \ No newline at end of file From 586f536544470ae7c7dd7c01f8f39296bed84f83 Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 25 May 2017 14:18:49 -0700 Subject: [PATCH 4/6] Revert "Adding circle ci" This reverts commit 24850a6be9669a34914ad238f9c4b92709d27b92. --- README.md | 6 +- .../.vscode/launch.json | 22 ------ express-testing-with-mocha-chai/app/server.js | 10 --- express-testing-with-mocha-chai/package.json | 26 ------- .../test/server.test.js | 21 ------ vanilla-basic-auth/src/index.js | 7 -- vanilla-basic-auth/test/index.test.js | 1 - vanilla-jasmine/spec/helpers/agent.js | 45 ++++++------ vanilla-jasmine/spec/index.spec.js | 69 ++++++++++++------- 9 files changed, 65 insertions(+), 142 deletions(-) delete mode 100644 express-testing-with-mocha-chai/.vscode/launch.json delete mode 100644 express-testing-with-mocha-chai/app/server.js delete mode 100644 express-testing-with-mocha-chai/package.json delete mode 100644 express-testing-with-mocha-chai/test/server.test.js delete mode 100644 vanilla-basic-auth/src/index.js delete mode 100644 vanilla-basic-auth/test/index.test.js diff --git a/README.md b/README.md index d9e55d7..4b1ad0c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ # node-examples -[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) -[![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) - -[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=shield)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) -[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=svg)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) +[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file diff --git a/express-testing-with-mocha-chai/.vscode/launch.json b/express-testing-with-mocha-chai/.vscode/launch.json deleted file mode 100644 index 102667c..0000000 --- a/express-testing-with-mocha-chai/.vscode/launch.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - // Use IntelliSense to learn about possible Node.js debug attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - // { - // "type": "node", - // "request": "launch", - // "name": "Launch Program", - // "program": "${workspaceRoot}\\app\\server.js" - // }, - { - "name": "Debug Mocha Test", - "request": "launch", - "type": "node", - "address": "localhost", - "port": 5858, - "sourceMaps": false - } - ] -} \ No newline at end of file diff --git a/express-testing-with-mocha-chai/app/server.js b/express-testing-with-mocha-chai/app/server.js deleted file mode 100644 index b78b60b..0000000 --- a/express-testing-with-mocha-chai/app/server.js +++ /dev/null @@ -1,10 +0,0 @@ -var express = require('express'); -var app = new express(); - -app.get('/', function(req, res) { - res.send('Hello World'); -}); - -app.listen(process.env.PORT || 3100); - -module.exports = app \ No newline at end of file diff --git a/express-testing-with-mocha-chai/package.json b/express-testing-with-mocha-chai/package.json deleted file mode 100644 index 8422450..0000000 --- a/express-testing-with-mocha-chai/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "express-testing-with-mocha-chai", - "version": "1.0.0", - "description": "Example of a express server with mocha and chai", - "main": "app\\server.js", - "scripts": { - "start": "node app\\server.js", - "test": "mocha --debug-brk" - }, - "keywords": [ - "Express", - "BDD", - "Mocha", - "Chai" - ], - "author": "Bernard Badenhorst", - "license": "ISC", - "dependencies": { - "express": "^4.15.2" - }, - "devDependencies": { - "chai": "^3.5.0", - "chai-http": "^3.0.0", - "mocha": "^3.3.0" - } -} \ No newline at end of file diff --git a/express-testing-with-mocha-chai/test/server.test.js b/express-testing-with-mocha-chai/test/server.test.js deleted file mode 100644 index b5a6578..0000000 --- a/express-testing-with-mocha-chai/test/server.test.js +++ /dev/null @@ -1,21 +0,0 @@ -var chai = require('chai'); -var chaiHttp = require('chai-http'); -var app = require('../app/server'); - -var expect = chai.expect; - -chai.use(chaiHttp); - -describe('App', function() { - describe('GET /', function() { - it('Responds with status 200 and "Hello World"', function(done) { - chai.request(app) - .get('/') - .end(function(err, res) { - expect(res).to.have.status(200); - - done(); - }); - }); - }); -}); \ No newline at end of file diff --git a/vanilla-basic-auth/src/index.js b/vanilla-basic-auth/src/index.js deleted file mode 100644 index 1f9b159..0000000 --- a/vanilla-basic-auth/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -var http = require('http'); -var port = process.env.PORT || 3000; - -var server = http.createServer(function (req, res) { - res.writeHead(200); - res.end('Hello world'); -}).listen(port, function () { console.log('server listening on port %s', port)}); \ No newline at end of file diff --git a/vanilla-basic-auth/test/index.test.js b/vanilla-basic-auth/test/index.test.js deleted file mode 100644 index 3c07346..0000000 --- a/vanilla-basic-auth/test/index.test.js +++ /dev/null @@ -1 +0,0 @@ -var assert = require('assert'); diff --git a/vanilla-jasmine/spec/helpers/agent.js b/vanilla-jasmine/spec/helpers/agent.js index f968a82..e590a31 100644 --- a/vanilla-jasmine/spec/helpers/agent.js +++ b/vanilla-jasmine/spec/helpers/agent.js @@ -57,34 +57,29 @@ request = function(options) { }; -var Agent = function(options) { - - var self = this; - self.options = options || {}; - self.options.port = options.port || 80; - self.options.host = options.host || options.hostname || options.address || ''; - - // Handle blank and unspecified ip addresses (default to localhost) - var map = { - '': 'localhost', - '::': 'localhost', - '0.0.0.0': 'localhost' - }; - if (map[self.options.host]) { - self.options.host = map[self.options.host]; - } +var Agent = function(server) { - self.get = function(path, options) { - options = options || {}; - options.method = 'GET'; - options.path = path; - options.host = self.options.host; - options.port = self.options.port; - - return request(options); + var agent = this; + agent._server = server; + var address = server.address(); + agent._port = address.port; + agent._host = address.hostname || address.address; + + // Handle unspecified ip addresses (default to localhost) + if (agent._host === '::' || agent._host === '0.0.0.0') + agent._host = 'localhost'; + + agent.get = function(path, options) { + var opt = options || {}; + opt.method = 'GET'; + opt.path = path; + opt.host = agent._host; + opt.port = agent._port; + + return request(opt); } - return self; + return agent; }; module.exports = Agent; diff --git a/vanilla-jasmine/spec/index.spec.js b/vanilla-jasmine/spec/index.spec.js index 9f7fae3..5082b4e 100644 --- a/vanilla-jasmine/spec/index.spec.js +++ b/vanilla-jasmine/spec/index.spec.js @@ -1,34 +1,53 @@ -var coveralls = require('coveralls'); var jasmine = require('jasmine'); +var server = require('../src'); +var Agent = require('./helpers/agent'); +var agent = new Agent(server); describe('Hello World Server', function () { + describe('GET /', function () { + it('returns with status code 200 and "Hello World" (text/plain)', function (done) { + agent.get('/') + .then(function (response) { + expect(response.statusCode).toBe(200); + expect(response.body).toBe('Hello World'); + expect(response.headers['content-type']).toBe('text/plain'); + done(); + }); + }); - describe('Server is not running', function() { + it('returns with status code 200', function (done) { + agent.get('/') + .then(function (response) { + expect(response.statusCode).toBe(200); + done(); + }); + }); - }); + it('returns with body "Hello World"', function (done) { + agent.get('/') + .then(function (response) { + expect(response.body).toBe('Hello World'); + done(); + }); + }); - console.log('Start server before running specs.'); - var server = require('../src'); - console.log('Create agent for testing server.'); - var Agent = require('./helpers/agent'); - var agent = new Agent(server.address()); + it('returns with content type "text/plain"', function (done) { + agent.get('/') + .then(function (response) { + expect(response.headers['content-type']).toBe('text/plain'); + done(); + }); + }); - afterAll(function(){ - console.log('\nClose server after running specs.'); - server.close(function() { - console.log('Closed server.'); - }); - }); + }); +}); - describe('GET /', function () { - it('returns with status code 200 and "Hello World" (text/plain)', function (done) { - agent.get('/') - .then(function (response) { - expect(response.statusCode).toBe(200); - expect(response.body).toBe('Hello World'); - expect(response.headers['content-type']).toBe('text/plain'); - done(); - }); - }); - }); +beforeAll(function() { + +}); + +afterAll(function(){ + server.close(function() { + console.log('\n\nClosed server after running specs.'); + }); }); \ No newline at end of file From 3aa87a5b8cb92ac00ca0075b71747e93046c839d Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 25 May 2017 14:20:12 -0700 Subject: [PATCH 5/6] Adding circleci badges --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b1ad0c..18cf1bb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ -# node-examples +# node-exa +[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) +[![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) -[![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) \ No newline at end of file +[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=shield)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) +[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=svg)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) \ No newline at end of file From 3608eb29a2d92b6a6acbc763fb89b03c1c62b4e3 Mon Sep 17 00:00:00 2001 From: pbbadenhorst Date: Thu, 25 May 2017 15:35:54 -0700 Subject: [PATCH 6/6] Adding code climate --- README.md | 10 +++++++--- package.json | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 18cf1bb..65a4984 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ -# node-exa +# node-examples + [![Build Status](https://travis-ci.org/pbbadenhorst/node-examples.svg?branch=vanilla-jasmine)](https://travis-ci.org/pbbadenhorst/node-examples) [![Coverage Status](https://coveralls.io/repos/github/pbbadenhorst/node-examples/badge.svg?branch=vanilla-jasmine)](https://coveralls.io/github/pbbadenhorst/node-examples?branch=vanilla-jasmine) - [![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=shield)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) -[![CircleCI](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine.svg?style=svg)](https://circleci.com/gh/pbbadenhorst/node-examples/tree/vanilla-jasmine) \ No newline at end of file + + +[![Code Climate](https://codeclimate.com/github/pbbadenhorst/node-examples/badges/gpa.svg)](https://codeclimate.com/github/pbbadenhorst/node-examples) +[![Test Coverage](https://codeclimate.com/github/pbbadenhorst/node-examples/badges/coverage.svg)](https://codeclimate.com/github/pbbadenhorst/node-examples/coverage) +[![Issue Count](https://codeclimate.com/github/pbbadenhorst/node-examples/badges/issue_count.svg)](https://codeclimate.com/github/pbbadenhorst/node-examples) \ No newline at end of file diff --git a/package.json b/package.json index d10f0d8..401d2b7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "app\\server.js", "dependencies": {}, "devDependencies": { + "codeclimate-test-reporter": "^0.4.1", "coveralls": "^2.13.1", + "cross-env": "^5.0.0", "istanbul": "^0.4.5", "jasmine": "^2.6.0" }, @@ -13,7 +15,9 @@ "vanilla-jasmine": "node vanilla-jasmine/src/index.js", "vanilla-jasmine-test": "istanbul cover vanilla-jasmine/spec/index.js", "vanilla-jasmine-coverage": "istanbul cover vanilla-jasmine/spec/index.js", - "report-coverage": "cat ./coverage/lcov.info | coveralls", + "report-coverage": "npm run script report-coverage:coveralls & npm run script report-coverage:codeclimate", + "report-coverage:coveralls": "cat ./coverage/lcov.info | coveralls", + "report-coverage:codeclimate": "cross-env CODECLIMATE_REPO_TOKEN=4cc379a927597359590431e4c81655d109e3be94e15269ad0cbf9701ec50c98f codeclimate-test-reporter < coverage/lcov.info", "start": "npm run vanilla-jasmine", "test": "npm run vanilla-jasmine-test", "coverage": "npm run vanilla-jasmine-coverage" @@ -30,4 +34,4 @@ ], "author": "Bernard Badenhorst", "license": "ISC" -} +} \ No newline at end of file