Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijitkini committed May 20, 2016
1 parent 64caf13 commit 005bacb
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# sample_nodejs
A simple node.js app used in Shippable tutorials
# nodejs
This repository contains the files necessary to run a sample application in Node.js and to run CI tests on Shippable.


Contents:
This repository has 6 files and the functions of each file are as follows:

1. README.md - Contains an some basic conventions and guidelines to show the working of folder level caching.
2. Shippable.yml - Configured for the language, version & to run a test during the CI step. http://docs.shippable.com/ci_configure/ gives you a detailed introduction on how to configure your CI on shippable.
3. Package.json - Installs all the libraries mentioned in dependencies list when we run npm install command from the root of this folder. The npm install command creates a new folder called node_modules which contains all the libraries mentioned in the dependency list.
4. index.js - Outputs "Welcome to Shippable" in a browser
5. test.js - Configured to run a simple unit test to check the syntax of the index.js output
6. Gruntfile.js - grunt file that loads express server and mocha Test
7. xunit.xml -
8. .gitignore - default file created at the time of creating this repository
23 changes: 23 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

module.exports = function (grunt) {
grunt.initConfig({
express: {
test: {
options: {
script: "index.js"
}
}
},
mochaTest: {
test: {
options: {
reporter: 'spec-xunit-file'
},
src: ["./test.js"]
}
}
});
grunt.loadNpmTasks("grunt-express-server");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.registerTask("default", ["express:test", "mochaTest"]);
};
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var express = require("express"),
app = express();

var connection = null;
app.get("/", function (req, res) {
res.send("Welcome to Shippable");
});

app.listen(3000, function () {
console.log('Express listening on port 3000');
});
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "sample-node-couchdb",
"version": "0.0.0",
"description": "Testing CouchDB service",
"main": "index.js",
"scripts": {
"test": "grunt"
},
"repository": {
"type": "git",
"url": "[email protected]:Shippable/sample_node.git"
},
"author": "Patrick Ellis",
"license": "MIT",
"bugs": {
"url": "https://github.com/Shippable/sample_node/issues"
},
"homepage": "https://github.com/Shippable/sample_node",
"dependencies": {
"express": "^4.2.0",
"nano": "^5.10.0",
"should": "^4.0.1",
"util": "~0.10.3",
"body-parser": "~1.4.2",
"express": "~4.3.1",
"request": "~2.67.0",
"parse-links": "*"
},
"devDependencies": {
"chai": "^1.9.1",
"grunt": "^0.4.5",
"grunt-express-server": "^0.4.17",
"grunt-mocha-test": "^0.12.7",
"mocha": "^1.18.2",
"superagent": "^0.18.0",
"spec-xunit-file": "0.0.1-3"
}
}
12 changes: 12 additions & 0 deletions shippable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js

node_js:
- 0.12

env:
- XUNIT_FILE=shippable/testresults/result.xml

build:
ci:
- npm install
- npm test
13 changes: 13 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var superagent = require("superagent"),
should = require("should");

describe("Index", function () {
it("renders HTML", function (done) {
superagent.get("http://localhost:3000/")
.end(function (e, res) {
(e === null).should.equal(true);
res.text.should.equal("Welcome to Shippable");
done();
});
});
});
Empty file added xunit.xml
Empty file.

0 comments on commit 005bacb

Please sign in to comment.