Leanpub Header

Skip to main content

Testeando Componentes de Vue.js con Jest

Una guía concisa y práctica para testear componentes de Vue.js usando Jest y la librería oficial vue-test-utils

En este libro vamos a cubrir cómo testear aplicaciones de Vue.js con el framework de testing desarrollado en Facebook, Jest. Gracias a vue-test-utils (la librería oficial de testing de VueJS) y a la magia de Jest, veremos cómo enfrentarnos a cualquier caso que tengamos que testear en los test unitarios de nuestros componentes de Vue. Happy testing!

This book is a translation into Spanish of Testing Vue.js components with Jest which was originally written in English

Minimum price

$9.99

$13.99

You pay

$13.99

Authors earn

$11.19
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
About

About

About the Book

☝ Esta es la traducción al Castellano del libro original "Testing Vue.js components with Jest", de Alex Jover Morales (Vue.js core team partner). Traducido por Paul Melero, Web developer y revisado por el propio Alex Jover.

Vue.js fue el framework que más gente marcó en 2018 como "desearía aprender" (fuente). Su crecimiento en el último año ha seguido aumentando fuertemente y no es de extrañar, dado lo productivo y flexible que es. Probablemente lo hayas usado ya, pero... ¿Has hecho testing de Vue.js?

Los tests unitarios de frameworks modernos de Javascript basados en componentes no siempre son sencillos. Los componentes se comunican unos con otros y el navegador añade una capa de UI, lo que hace que todo sea dependiente mientras que nosotros queremos testear los componentes de manera aislada. Nuestras test suites deberían darnos la confianza confianza suficiente para que nuestras codebases sean mantenibles y si podemos pedir algo más es que se ejecuten de manera rápida! ⚡

En este libro, enseñamos, de manera práctica, cómo testear componentes de Vue.js y aprovecharnos de las funcionalidades del framework de testing Jest. Te guiará por el testeo de conceptos básicos como estado local, props, estructura y estilos; e iremos avanzando testeando diferentes aspectos del comportamiento de componentes de Vue.js. También verás cómo aplicar las técnicas del snapshot testing, shallow rendering, simulación de dependencias de módulos externos y muchas cosas más; para hacer de manera correcta, limpia y rápida el unit testing de nuestras aplicaciones de Vue.js.

? Testeando componentes e Vue.js con Jest. ?

Share this book

Categories

This book is a translation into Spanish of Testing Vue.js components with Jest which was originally written in English

Author

About the Authors

Alex Jover Morales

Vue.js core team partner. Co-organizes @AlicanteFront and Vue Day. Instructor @eggheadio at @alligatorio. Interested on Web Performance, PWA, code quality and the human side of code.

Paul Melero

Frontend Web Developer (now with more Backend!). Former graffiti artist now focused on web development. Frontend enthusiast. OSS passionate.

Contents

Table of Contents

1.Escribe tu Primer Test Unitario de un Componente de Vue.js con Jest

  1. Set up de un proyecto de ejemplo
  2. Testeando un Componente
  3. Testeando con @vue/test-utils

2.Testear Componentes Anidados de Vue.js en Jest

  1. Añadir un Componente de Mensaje
  2. Testeamos el componente padre ListaMensajes con los hijos Mensaje

3.Testing de Estilos y Estructura de Componentes Vue.js en Jest

  1. El Objeto Wrapper
  2. Resumiendo

4.Testeo de Propiedades (Props) y Custom Events en Componentes Vue.js con Jest

  1. Propiedades
  2. Eventos Custom
  3. Resumiendo

5.Testear Computed Properties y Watchers en Componentes Vue.js con Jest

  1. Computed Properties
  2. Watchers
  3. Conclusión

6.Testear Métodos y Dependencias Mock en Vue.js con Jest

  1. Simular Dependencias de Módulos Externos
  2. Dejando los Mocks Externalizados
  3. Conclusión

7.Testeo de Slots en Vue.js con Jest

  1. Reescribimos ListaMensajes con slots
  2. $children and $slots
  3. Testeando Slots
  4. Testeando Named Slots
  5. Testeando las Especificaciones de Slots en su Contexto
  6. Conclusión

8.Expandir la Configuración de Jest con Alias de Módulos

  1. Alias de Webpack
  2. Alias Múltiples
  3. Otras soluciones
  4. Conclusión

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub