Testing a compiler-driven full-stack web framework

https://news.ycombinator.com/rss Hits: 10
Summary

Wasp is a compiler-driven full-stack web framework; it takes configuration and source files with your unique logic, and it generates the complete source code your the web app. Think of a Rails-like framework for React, Node.js and Prisma. As a result of our approach and somewhat unique design, we have a large surface area to test. Every layer can break in its own creative way, and a strong suite of automated tests is what keeps us (somewhat) sane. In this article, our goal is to demonstrate the practical side of testing in a compiler-driven full-stack framework, where traditional testing intersects with code generation and developer experience. Our approach to tests​ If we wanted to reduce our principle to a single sentence, it would be: We believe that test code deserves the same care as production code. Bad tests slow you down. They make you afraid to change things. So our principle is simple: if a piece of test code matters enough to catch a bug, it matters enough to be well-designed. We refactor it. We name things clearly. We make it easy to read and reason about. It’s not new or revolutionary; it’s just consistent care, applied where most people stop caring. Tests that explain themselves​ Our guiding principle is that tests should be readable at a glance, without requiring an understanding of the machinery hiding underneath. That’s why we write them so that the essence of the test, the input and expected output, comes first. Supporting logic and setup details follow afterward, only for those who need to understand the details. spec_kebabToCamelCase :: Specspec_kebabToCamelCase = do "foobar" ~> "foobar" "foo-bar-bar" ~> "fooBarBar" "foo---bar-baz" ~> "fooBarBaz" "-foo-" ~> "foo" "--" ~> "" "" ~> "" where kebab ~> camel = it (kebab ++ " -> " ++ camel) $ do kebabToCamelCase kebab `shouldBe` camel That rule naturally connects to the next one: tests should be descriptive enough that you can understand their essence without additional comments. That’s why sometimes w...

First seen: 2025-10-08 17:14

Last seen: 2025-10-15 02:40