Volver al radar Desarrollo con IA

Your unit tests are paying an unnecessary DOM tax

Open the test configuration of almost any front-end project and you’ll find one line that decides more about your CI bill than most of the code around it: environment: 'jsdom'. Unit and component tests for React, Vue, Angular, Svelte, and Solid apps rarely run in a real browser.

Open the test configuration of almost any front-end project and you’ll find one line that decides more about your CI bill than most of the code around it: environment: 'jsdom'. Unit and component tests for React, Vue, Angular, Svelte, and Solid apps rarely run in a real browser.

For most teams that library is jsdom, the long-standing, standards-minded default. A growing number use happy-dom, which is faster but less faithful. Few teams think about the choice again after the first npm install. They should, because the test DOM is often where a component suite spends a large share of its time, and because the two popular options force a trade that most teams don’t know they’re making.

Over the past months I measured this on real projects. Here is what I found, and what I built as a result.

A component test does very little work of its own. It creates elements, sets attributes, dispatches events, and reads back state. Every one of those steps is a call into the DOM implementation, and DOM APIs are chatty: a single high-level call can fan out into hundreds of internal ones.

To see how chatty, I built an open-source tracer, dom-api-tracer, that records which DOM APIs a test suite calls and how often. One example from those traces: a single getComputedStyle() call in jsdom triggered about 1,000 reads of Node and Element properties inside the library, because resolving styles means matching selectors against the tree. Testing libraries call getComputedStyle() constantly, for instance to decide whether an element is visible.

Multiply that by tens of thousands of tests and the DOM is no longer a detail. On Ant Design’s suite of React components, swapping the DOM implementation alone took a CI run from about 30 minutes to 6.7 minutes. Nothing else changed: same tests, same runner, same machine.

In context

  • Topic: Desarrollo con IA — Copilotos y agentes en el ciclo de desarrollo de software.
  • Source: InfoWorld
  • Published: 23/11/2026

Continue reading at the original source →

Excerpt published automatically by the site radar. The full text belongs to its publisher and is linked above.

Por qué importa

Cuando aparece una herramienta que promete acelerar el desarrollo, la pregunta útil no es cuánto código genera sino cuánto trabajo genera aguas abajo. Pruebas, revisión, seguridad, deuda técnica, incidentes: ahí es donde se paga o se cobra la promesa.

Yo lo miro desde la operación, no desde la demo. La pregunta no es si el asistente escribe una función correcta, sino si el equipo puede sostener seis meses después lo que produjo, con otra gente, sin el contexto original. Esa es la prueba real y casi nunca aparece en los anuncios.

Lo que suele salir mal

El problema aparece cuando alguien acepta código que no entiende del todo pero que pasa las pruebas. Funciona, entra a producción, y seis meses después hay que modificarlo. Ahí se descubre que nadie en el equipo puede explicar por qué está escrito así, y el cambio chico se convierte en una reescritura.

Qué mirar

  • Qué pasa con las pruebas — generar código sin generar pruebas solo mueve el problema hacia adelante.
  • Dónde viaja el código fuente cuando se usa el asistente, y qué dice el contrato sobre eso.
  • El efecto sobre la gente que recién entra al equipo, que es donde más rápido se pierde el criterio.

Cómo leo esta entrada

Lo que yo pediría medir no es líneas ni sugerencias aceptadas, sino defectos que llegan a producción y tiempo de revisión por cambio. Si esas dos bajan, la herramienta sirve. Si suben mientras sube la velocidad, se está acumulando una deuda que se paga con incidentes.

La noticia original está publicada en otro idioma; acá se cita el extracto tal como lo entrega el medio y el comentario se escribe en español.
Compartir

Comentarios

Todavía no hay comentarios. El primero puede ser el tuyo.

Solo texto, sin enlaces. No se pide correo. Los comentarios se revisan antes de publicarse.

¿Lo estás viviendo en tu equipo?

Abrí el chat y contame cómo lo están manejando. Me interesa comparar notas.

Seguir leyendo

Otras entradas del radar

Ver todas
Darinel Ortega En línea · respondo durante el día
Hoy
Hola. Acá no vendo nada: esto es para intercambiar conocimiento sobre tecnología.
Escribime lo que quieras — podés mandar texto, imágenes o documentos. Los mensajes llegan a mi consola y te respondo desde ahí.
Estás escribiendo fuera de horario. Te leo apenas empiece el día.

Conversación abierta para compartir conocimiento. Los mensajes llegan a mi consola y respondo desde ahí.

Agendemos una conversación

Elegí el día y la hora que te sirvan. Son treinta minutos, sin agenda comercial.

Videollamada

Para una videollamada, pedila por acá y te paso el enlace de la sesión.