Run SmartJsRunning SmartJs always follows the same flow
|
Running the Unit Tests
When running the Unit Tests, you need to set up a QA website that points to the SmartJs project root. That way the test files can find the test target files in the client folder in-place, without having to make copies of them.
- Set up your workstation according to the setup instructions
- Browse to the index of the unit tests in the qa folder in the website pointed at the SmartJs project root. The default setup is for that to be on port 100. So the unit test index would be: http://localhost:100/qa/unitTest/index.html
- Click each link to run the tests for each module
Building with r.js
The /qa/builds folder of SmartJs contains 2 r.js build scripts for each platform. There are separate scripts for prod and non-prod, which could be built out into a more comprehensive matrix of environments and configurations. These scripts use a naming convention to connect them to a set of subfolders under /qa/builds and the names also correspond to the configurations available in /client/app/config.js. The config.js module will pick up variables set by the build script to dynamically generate the correct config and environment as specified in the build script.
The Android build outputs its built main.js to a deeper subfolder under /qa/builds/android/assets/www/app. That is because the /qa/builds/android folder is a complete Android project that is ready to deploy using the steps in the Cordova Getting Started for Android. The getting started guide's original hello world content is preserved in SmartJs under /qa/builds/android/_helloWorld.
There is also a build.debug.js script included which does all of the work to combine the application modules into one js file. But the uglification is turned off so that the source is intact. This proved to be very useful in debugging builds. We can generate a build targeted to a device, but still get the benefit of meaningful function names when console logging for debug.
To allow me to easily run any build, I have included compileJs.bat which takes a command line parameter of the build name to run. It is just a simple way to run r.js without having to remember the command line switches I need.
The Android build outputs its built main.js to a deeper subfolder under /qa/builds/android/assets/www/app. That is because the /qa/builds/android folder is a complete Android project that is ready to deploy using the steps in the Cordova Getting Started for Android. The getting started guide's original hello world content is preserved in SmartJs under /qa/builds/android/_helloWorld.
There is also a build.debug.js script included which does all of the work to combine the application modules into one js file. But the uglification is turned off so that the source is intact. This proved to be very useful in debugging builds. We can generate a build targeted to a device, but still get the benefit of meaningful function names when console logging for debug.
To allow me to easily run any build, I have included compileJs.bat which takes a command line parameter of the build name to run. It is just a simple way to run r.js without having to remember the command line switches I need.