andreasgal/PhoneNumber.js — pull request #33 by andris9 (2013-12-07 16:41:56+00:00)
Title: Use Grunt instead of make, added QUnit tests that can be run in a browser

> This pull request includes two independent commits. I wasn't really sure how to do two separate pull requests in Github, sorry.

### Grunt build system

The commit https://github.com/andris9/PhoneNumber.js/commit/a9da3c0866899944c1a9b964f5d6ab413f3618eb replaces default build system `make` with [Grunt](http://gruntjs.com/). The reason for this is to keep everything in JavaScript (Grunt uses Node.js) which enables building the metadata file even in Windows. Updated build system does not use Python for converting metadata but a separate Node.js module created specifically for this task [libphonenumber-convert](https://github.com/andris9/libphonenumber-convert). The converter module is basically a port of xml2meta.py to JavaScript, except that the output is fully JSON compatible (makes it possible to replace `eval` with `JSON.parse` (see also #32) in PhoneNumber.js, [also covered](https://github.com/andris9/PhoneNumber.js/commit/a9da3c0866899944c1a9b964f5d6ab413f3618eb#diff-dcffe01ddc50e972aa93c60c43411f4dR56) by this commit).

### QUnit test runner

The commit https://github.com/andris9/PhoneNumber.js/commit/f99ae198385278953a50e7482d1b613b86a1f03a adds QUnit based test runner to PhoneNumber.js. I converted all the tests from test.js to QUnit tests. This is useful for running the tests in a browser. Currently the tests pass only in browsers that support `let` which basically means just Firefox (`let` support is enabled in the tests by setting JavaScript version to 1.7 when loading Phonenumber.js). Once you have run `grunt` (or `make` if you have not pulled the previous commit), you can open tests/index.html in your browser to see if the tests pass.