---
title: "Balancing Old Tricks with New Feats: AI-Powered Conversion From Enzyme to React Testing Library at Slack"
description: "Slack converted over 15,000 Enzyme tests to React Testing Library ahead of its React 18 upgrade by combining AST codemods with an LLM (Claude 2.1)."
url: "https://swe.quest/articles/balancing-old-tricks-with-new-feats-ai-powered-conversion-from-enzyme-to-react-0b1af45f56ad7d09"
canonical: "https://slack.engineering/balancing-old-tricks-with-new-feats-ai-powered-conversion-from-enzyme-to-react-testing-library-at-slack/"
source: "Slack Engineering"
published: "2024-05-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 15
tags: ["testing","ai-coding","refactoring","react","llms"]
---

# Balancing Old Tricks with New Feats: AI-Powered Conversion From Enzyme to React Testing Library at Slack

A post on [Slack Engineering](https://swe.quest/sources/slack.md), published 2024-05-22, 15 min read, Case study. Original: [https://slack.engineering/balancing-old-tricks-with-new-feats-ai-powered-conversion-from-enzyme-to-react-testing-library-at-slack/](https://slack.engineering/balancing-old-tricks-with-new-feats-ai-powered-conversion-from-enzyme-to-react-testing-library-at-slack/)

## Summary

Slack converted over 15,000 Enzyme tests to React Testing Library ahead of its React 18 upgrade by combining AST codemods with an LLM (Claude 2.1). AST transformations alone converted about 45% of code. The LLM alone fluctuated between 40-60%. A hybrid pipeline reached about 80% on evaluated files. It fed the LLM the original test, a partially converted codemod output with in-code instructions, and the actual rendered DOM captured per test case via overridden Enzyme mount/shallow methods. A structured prompt with explicit required and optional tasks constrained hallucinations and improved results by 20-30% over the out-of-the-box LLM.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- React component testing ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Enzyme and React Testing Library ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- AST codemods
- LLM prompting ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Enzyme, React Testing Library, React 18, Claude 2.1, Jest, codemod, Abstract Syntax Tree

## Related posts

- [Helix: The internal tool powering our Shopify app's native migration](https://swe.quest/articles/helix-the-internal-tool-powering-our-shopify-app-s-native-migration-db9fcd596ae9b1fc.md): Shopify Engineering · 2026-09-21 · Medium · 8 min read · AI for coding, AI agents, Mobile, Refactoring & migrations, React
  Helix is Shopify's internal LLM tooling for rebuilding its 300+ screen React Native app in native Swift and Kotlin.
- [LLM powered migration of UI component libraries](https://swe.quest/articles/llm-powered-migration-of-ui-component-libraries-8df39cf5988787fc.md): Zalando Engineering · 2025-02-19 · Medium · 14 min read · AI for coding, Refactoring & migrations, LLMs, Design systems, Frontend
  Zalando's Partner Tech team migrated 15 B2B applications between two in-house UI component libraries using GPT-4o, after five hackathon iterations showed that accuracy came from combining generated component interfaces, manually verified attribute mappings (e.g. old "medium" button maps to new "large") and worked examples in the prompt.
- [LLMs Are the Key to Mutation Testing and Better Compliance](https://swe.quest/articles/llms-are-the-key-to-mutation-testing-and-better-compliance-3f8016e770f9b659.md): Meta Engineering · 2025-09-30 · Easy · 9 min read · Testing, LLMs, AI for coding, Privacy
  Meta's Automated Compliance Hardening (ACH) tool uses LLMs to make mutation testing practical at scale.
- [How to Fix ESLint Violations with AI Assistance](https://swe.quest/articles/how-to-fix-eslint-violations-with-ai-assistance-74d040edadf71958.md): Docker · 2024-08-26 · Medium · 8 min read · AI for coding, AI agents, Static analysis, TypeScript, LLMs
  An LLM can produce correct fixes for ESLint violations once it has tools that supply minimal, precise context.
- [Autoresearch isn’t just for training models](https://swe.quest/articles/autoresearch-isn-t-just-for-training-models-00e59e41077ad95c.md): Shopify Engineering · 2026-04-15 · Easy · 8 min read · AI agents, Performance engineering, Build systems, CI/CD, Developer productivity
  Generalizing Karpathy's Autoresearch beyond model training, Shopify built pi-autoresearch, an extension for the Pi agent harness that runs an agent in an endless loop against a single measurable metric: establish a baseline, form a hypothesis, test it, keep improvements and discard crashes or regressions.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
