Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nodejs, mocha y un poco de travis-ci

JuanPablo
February 12, 2015
47

Nodejs, mocha y un poco de travis-ci

JuanPablo

February 12, 2015
Tweet

Transcript

  1. “Un controlador de versiones, testing y esas cosas no son

    para mi, no tengo tiempo para eso y no trabajo con colaboradores" 1
  2. 5 Iniciar package.json n p m i n i t

    Creará en archivo p a c k a g e . j s o n donde se describen características de nuestra aplicación, como dependencias. c a t p a c k a g e . j s o n
  3. 6 Instalar expressjs n p m i n s t

    a l l e x p r e s s — s a v e El argumento — s a v e registra express como dependencia en el archivo p a c k a g e . j s o n c a t p a c k a g e . j s o n
  4. 7 server.js https://gist.github.com/juanpabloaj/d93e377102078ecf5b5f (https://gist.github.com/juanpabloaj/d93e377102078ecf5b5f) v i m s e r

    v e r . j s g i t i n i t w g e t j . m p / n o d e _ g i t i g n o r e & & m v n o d e _ g i t i g n o r e . g i t i g n o r e g i t a d d . g i t c o m m i t - m " h o l a d e s d e n o d e j s "
  5. 8 nodemon Servir y reiniciar aplicación cuando se realicen cambios

    cambios n p m i n s t a l l n o d e m o n - g n o d e m o n
  6. 10 Crear la descripción de un test Crear un directorio

    t e s t y un archivo t e s t / a p p . j s https://gist.github.com/6ff44912c34dd4f52131 (https://gist.github.com/6ff44912c34dd4f52131) llamar a mocha m o c h a
  7. 11 Test con supertest y should n p m i

    s h o u l d s u p e r t e s t - - s a v e - d e v Editar el archivo t e s t / a p p . j s https://gist.github.com/9cf7186eaa43b3c2d6f5 (https://gist.github.com/9cf7186eaa43b3c2d6f5) Llamar a mocha m o c h a
  8. 12 Code style n p m i j s h

    i n t - g jshint (http://jshint.com/about/) para verificar el código. w g e t j . m p / j s h i n t r c & & m v j s h i n t r c j s h i n t r c j s h i n t s e r v e r . j s t e s t / a p p . j s
  9. 13 Travis-ci https://travis-ci.org/ (https://travis-ci.org/) Servicio de integración continua (http://www.thoughtworks.com/continuous- integration).

    Enfocarse en escribir código, que travis se encargue de correr los test y hacer el deploy de tus aplicaciones. https://travis-ci.org/juanpabloaj/meetup-js-20150114/builds/46601019 (https://travis-ci.org/juanpabloaj/meetup-js-20150114/builds/46601019)
  10. 14 Enlaces http://nodejs.org/ (http://nodejs.org/) http://nitrous.io (http://nitrous.io) http://c9.io (http://c9.io) http://expressjs.com/api.html (http://expressjs.com/api.html)

    http://mochajs.org/ (http://mochajs.org/) http://www.thoughtworks.com/continuous-integration (http://www.thoughtworks.com/continuous-integration) http://jshint.com/about/ (http://jshint.com/about/) https://travis-ci.org/ (https://travis-ci.org/) https://speakerdeck.com/juanpabloaj/unit-test (https://speakerdeck.com/juanpabloaj/unit-test) https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4 (https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4) https://github.com/juanpabloaj/meetup-js-20150114 (https://github.com/juanpabloaj/meetup-js-20150114)