Git Product home page Git Product logo

js-test-kit's Introduction

js-test-kit

A starter-kit for testing front-end Javascript.

System Requirements

The kit in this repository relies on Docker and the Docker Compose tools.

Getting Started

The tooling in this repository all runs inside Docker containers, so to get running:

  • Copy the files in this repository wherever your front-end code is going to live
  • Edit some of the files, like package.json and test_runner.html to reference your own project
  • Run make test

Remember, this is a starter-kit, so it's expected that you will tweak some of the configuration options to better suite your individual needs.

Chai Test Interfaces

By default the assert interface is loaded from Chai, but if you would like to use the should or expect interfaces you can do so by editing test_runner.html.

Technical Details

This project uses Babel, Rollup, Livereload, Mocha, and Chai to provide a reactive, in-browser test environment for Javascript code. A running test environment launches three containers, two of which are based on an LTS version of node: rollup, livereload, and nginx. Each of these containers volume mounts a shared node_modules folder which lives inside a defined Docker volume.

The container responsibilities are:

  • rollup: uses babel to compile ES6 code and bundle code into a single file to avoid modifying test_runner.html
  • livereload: watches the generated test bundle for changes and reloads the browser window
  • nginx: provides easy serving of test_runner.html and js/css from under the node_modules Docker volume

The in-browser test page is opened automatically by default, and can easily be changed by removing the lines referencing $(OPEN_BIN) in the Makefile.

If you want to use webpack or typescript instead, changes only need to be made to the test-compiler npm script, as well as adding your configuration for bundling and compilation.

js-test-kit's People

Contributors

dependabot[bot] avatar

Watchers

Stephan Tarulli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.