diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8d8f05a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +sudo: false +before_script: + - npm install + - npm install -g mocha +node_js: 4 +script: + - mocha test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2226380 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:4-onbuild + +# Create app directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + + +# Install app dependencies + +# mocha global [todo: do we need this to be global?] +RUN npm install -g mocha + +ONBUILD COPY package.json /usr/src/app/ +ONBUILD RUN npm install +ONBUILD COPY . /usr/src/app + +CMD [ "npm", "test" ] \ No newline at end of file diff --git a/README.md b/README.md index 9ab7901..c28def7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# leftpad-sdk +# leftpad-sdk [![Build Status](https://travis-ci.org/ayc/leftpad-sdk.svg?branch=master)](https://travis-ci.org/ayc/leftpad-sdk) We were all saddened and shocked by the sudden disappearance of the `left-pad` NPM module. We were lost and unable to left-pad our strings, until one adventurous person decided to develop a RESTful API to offer that same functionality under a revolutionary new technology called SMaaS (String Manipulation as a Service). Believe you me, this is going to be bigger than The Cloud. You can read more about it on its site: http://left-pad.io/ @@ -24,4 +24,30 @@ promise.then(function(ret) { console.log(ret.body.str) }) ``` similarly to the previous example, this will print `#########hello world`. +### Testing + +Tests are handled by [mochajs](http://mochajs.org/). To install with npm: +``` +npm install -g mocha +``` + +To run tests simply: +``` +npm test +``` + +### Docker + +If you wish to run test without installing anything on your local machine, run it behind a [docker](https://www.docker.com/) container. + +Just build your image +``` +docker build -t leftpad . +``` + +And run it +``` +docker run leftpad +``` + That's all.