Using Webpack 1 to bundle TypeScript 2 files. This project is an example on how to setup Unit Testing in a TypeScript 2 project using Karma as test runner and Jasmine as test framework. The project code itself tries to mimic a simplistic real-life example. It does that by using Webpack 1 to bundle TypeScript 2 files and including jQuery as JavaScript library.
Clone this project and follow these steps to get it up and running on your own computer.
- Install NodeJS and NPM for your system
- Install Yarn for your system (Why Yarn? Because NPM is so 2016. But seriously, read the pros on their website)
- Install Gulp globally:
yarn add gulp --global
- Install project dependecies:
yarn install
You can use either gulp test
or it's alias yarn test
to run the karma test runner.
You can run gulp
to build the project. Eventually when the build completes you'll find all the necessary files in the dist/
folder.
It's possible to serve the files in this folder as a static website. You can use a simple webserver like http-server
for testing purposes.
For easier debugging you could also serve the build/
folder as static website. The uncompressed JavaScripts will be served when you load the index.html from that location.