state-machine

This project is an exercise to setup a typescript project from scratch, to understand the different parts that are involved in the process.

Steps:

  1. configure the typescrip compiler using es6 module settings.
  2. add webpack to run the app on the browser a, using the babel-loader.
  3. add test using mocha/chai
  4. add coverage reports using nyc

The code used is a naive implementation of a state machine.

Notes on npm and typescript

Update npm

npm i -g npm@latest

Install the project

npm install

Run the project

Build the project

npm run build

Running the node app

node dist/main.js

launching a python server

python -m http.server 8080

http://localhost:8080/dist/

Run the tests

This runs a script that set an env variable for mocha.

  • without coverage
npm test
  • with coverage Test reports are generated under the coverage folder, the coverage is also displayed in the console.
npm run test-with-coverage