forked from Riturajcse/Test-sample_nodejs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64caf13
commit 005bacb
Showing
7 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
}); |