Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!groovy

node{
stage 'Checkout'
checkout scm

stage 'Setup'
sh 'npm config set registry http://registry.npmjs.org/'
sh 'npm install'

stage 'Mocha test'
sh './node_modules/mocha/bin/mocha'

stage 'Cleanup'
echo 'prune and cleanup'
sh 'npm prune'
sh 'rm node_modules -rf'
}
15 changes: 15 additions & 0 deletions helloworld.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var http = require("http")

http.createServer(function (request, response) {

// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'})

// Send the response body as "Hello World"
response.end('Hello World')
}).listen(3000)

// Console will print the message
console.log('Server running')
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "helloworld",
"version": "1.0.0",
"description": "",
"main": "helloworld.js",
"scripts": {
"test": "node_modules/mocha/bin/mocha"
},
"repository": {
"type": "git",
"url": "https://github.com/SWDV660helloworldtest/helloworld.git"
},
"author": "",
"license": "BSD",
"bugs": {
"url": "https://github.com/SWDV660helloworldtest/helloworld/issues"
},
"devDependencies": {
"mocha": "~2.5.3",
"zombie": "~3.0.15"
}
}
21 changes: 21 additions & 0 deletions test/helloworld_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var Browser = require('zombie')
var assert = require('assert')
var app = require('../helloworld')


describe('main page', function() {
before(function(){
this.browser = new Browser({ site: 'http://localhost:3000' })
})

before(function(done) {
this.browser.visit('/', done)
})

it('should say hello world', function() {
assert.ok(this.browser.success)
assert.equal(this.browser.text(), "Hello World")
})
})


18 changes: 18 additions & 0 deletions test/npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/bin/npm', 'test' ]
2 info using npm@1.3.6
3 info using node@v0.10.48
4 error Error: ENOENT, open '/home/ec2-user/helloworld/test/package.json'
5 error If you need help, you may report this log at:
5 error <http://github.com/isaacs/npm/issues>
5 error or email it to:
5 error <npm-@googlegroups.com>
6 error System Linux 4.14.47-56.37.amzn1.x86_64
7 error command "node" "/usr/bin/npm" "test"
8 error cwd /home/ec2-user/helloworld/test
9 error node -v v0.10.48
10 error npm -v 1.3.6
11 error path /home/ec2-user/helloworld/test/package.json
12 error code ENOENT
13 error errno 34
14 verbose exit [ 34, true ]