Building a Test Framework From Scratch

  • Must be a Node-based CLI framework

  • Must be able to test browser-based JS apps

  • Must require very, very little setup

  • Must be able to test a whole application, not just one little widget

  • CLI must have a ‘watch mode’ so we don’t have to keep restarting it over and over

  • CLI must automatically find and run all files in our project that have a name of "*.test.js"

Download the code

Node by default doesn’t have any idea of a DOM or of query selectors of event listeners or stuff like that.

We want to build a testing framework that runs with Node.js but simultaneously we must be able to test browser-based JavaScript applications.

We’re going to make sure that we can test a browser-based JavaScript application even though we are running some code based on Node.js. The whole issue here is that with Node.js we do not have access to the browser. So the question of how do we actually test a browser-based JavaScript application, starts to get really kind of complicated because that browser-based app is going to try to access the DOM using methods that are built into the browser and so on.

We are going to run a little library inside of our testing tool that is going to simulate a browser inside of Node.js


Test Framework

Our own testing framework that will work in about 80% of all projects.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *