BuildingXwithJS / proposals

Place for proposals on things to build, talk and review during livestreams
MIT License
20 stars 1 forks source link

Testing framework #34

Closed rishabhkalra closed 5 years ago

rishabhkalra commented 5 years ago

A bunch of testing frameworks already exist but I'd like to learn how to build something relatively basic, doesn't have to be anywhere nearly as fully featured as some of the popular frameworks like Tape, Jasmine, Mocha to name a few. Aggregating test results into a dashboard or something like that might also be cool. This could be turned into a multi-part series where we can build additional functionality as we go.

yamalight commented 5 years ago

Here's the problem - at the very basic level all testing framework does is:

if (value !== expected) {
  throw new Error(`Expected value to be ${expected}, but got ${value}`);
}

But there's so many tiny intricate things around that if (runners, additional validators, env helpers, etc) that it'd take ~10 episodes just to build a basic version of something like node-tap. I don't think it's worth it to be honest. If you really want to see how those frameworks are built - read the code for node-tap. It's probably one of the simplest testing frameworks out there and its codebase is relatively small.

So, I'm going to reject this.