OLD | NEW |
| (Empty) |
1 # Building and Testing AngularDart | |
2 | |
3 This document describes how to set up your development environment to build and
test AngularDart, and | |
4 explains the basic mechanics of using `git`, `node`, and `npm`. | |
5 | |
6 See the [contributing guidelines](https://github.com/angular/angular.dart/blob/m
aster/CONTRIBUTING.md) for how to contribute your own code to | |
7 | |
8 1. [Prerequisite Software](#prerequisite-software) | |
9 2. [Getting the Sources](#getting-the-sources) | |
10 3. [Environment Variable Setup](#environment-variable-setup) | |
11 4. [Installing NPM Modules and Dart Packages](#installing-npm-modules-and-dart-p
ackages) | |
12 5. [Running Tests Locally](#running-tests-locally) | |
13 6. [Continuous Integration using Travis](#continuous-integration-using-travis) | |
14 | |
15 ## Prerequisite Software | |
16 | |
17 Before you can build and test AngularDart, you must install and configure the | |
18 following products on your development machine: | |
19 | |
20 * [Dart](https://www.dartlang.org/): as can be expected, AngularDart requires | |
21 an installation of the Dart-SDK and Dartium (a version of | |
22 [Chromium](http://www.chromium.org) with native support for Dart through the | |
23 Dart VM). One of the **simplest** ways to get both is to install the **Dart | |
24 Editor bundle**, which includes the editor, sdk and Dartium. See the [Dart | |
25 tools download page for | |
26 instructions](https://www.dartlang.org/tools/download.html). | |
27 | |
28 * [Git](http://git-scm.com/) and/or the **Github app** (for | |
29 [Mac](http://mac.github.com/) or [Windows](http://windows.github.com/)): the | |
30 [Github Guide to Installing | |
31 Git](https://help.github.com/articles/set-up-git) is a good source of | |
32 information. | |
33 | |
34 * [Node.js](http://nodejs.org): We use Node to run a development web server, | |
35 run tests, and generate distributable files. We also use Node's Package | |
36 Manager (`npm`). Depending on your system, you can install Node either from | |
37 source or as a pre-packaged bundle. | |
38 | |
39 ## Getting the Sources | |
40 | |
41 Forking and Cloning the AngularDart repository: | |
42 | |
43 1. Login to your Github account or create one by following the instructions give
n [here](https://github.com/signup/free). | |
44 Afterwards. | |
45 2. [Fork](http://help.github.com/forking) the [main AngularDart repository](http
s://github.com/angular/angular.dart). | |
46 3. Clone your fork of the AngularDart repository and define an `upstream` remote
pointing back to the AngularDart repository that you forked in the first place: | |
47 | |
48 ```shell | |
49 # Clone your Github repository: | |
50 git clone git@github.com:<github username>/angular.dart.git | |
51 | |
52 # Go to the AngularDart directory: | |
53 cd angular.dart | |
54 | |
55 # Add the main AngularDart repository as an upstream remote to your repository: | |
56 git remote add upstream https://github.com/angular/angular.dart.git | |
57 ``` | |
58 | |
59 ## Environment Variable Setup | |
60 | |
61 | |
62 Define the environment variables listed below. These are mainly needed for the | |
63 test scripts. The notation shown here is for | |
64 [`bash`](http://www.gnu.org/software/bash/); adapt as appropriate for your | |
65 favorite shell. (Examples given below of possible values for initializing the | |
66 environment variables assume Mac OS X and that you have installed the Dart | |
67 Editor in the directory named by `$DART_EDITOR_DIR`. This is only for | |
68 illustrative purposes.) | |
69 | |
70 ```shell | |
71 # CHROME_BIN: path to a Chrome browser executable; e.g., | |
72 export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" | |
73 | |
74 # CHROME_CANARY_BIN: path to a Dartium browser executable; e.g., | |
75 export CHROME_CANARY_BIN="$DART_EDITOR_DIR/chromium/Chromium.app/Contents/MacOS/
Chromium" | |
76 ``` | |
77 **Note**: the `$CHROME_CANARY_BIN` environment variable is used by karma to run
your tests | |
78 in dartium instead of chromium. If you don't do this, the dart2js compile will m
ake the tests | |
79 run extremely slow since it has to wait for a full js compile each time. | |
80 | |
81 You should also add the Dart SDK `bin` directory to your path and/or define `DAR
T_SDK`; e.g. | |
82 | |
83 ```shell | |
84 # DART_SDK: path to a Dart SDK directory; e.g., | |
85 export DART_SDK="$DART_EDITOR_DIR/dart-sdk" | |
86 | |
87 # Update PATH to include the Dart SDK bin directory | |
88 PATH+=":$DART_SDK/bin" | |
89 ``` | |
90 ## Installing NPM Modules and Dart Packages | |
91 | |
92 Next, install the modules and packages needed to run AngularDart tests: | |
93 | |
94 ```shell | |
95 # Install node.js dependencies: | |
96 npm install | |
97 | |
98 # Install karma onto your command line (optional) | |
99 npm install karma -g | |
100 | |
101 # Install Dart packages | |
102 pub install | |
103 ``` | |
104 | |
105 ## Running Tests Locally | |
106 | |
107 NOTE: scripts are being written to embody the following steps. | |
108 | |
109 To run base tests: | |
110 | |
111 ```shell | |
112 # Source a script to define yet more environment variables | |
113 . ./scripts/env.sh | |
114 | |
115 # Run io tests: | |
116 dart --checked test/io/all.dart | |
117 | |
118 # Run expression extractor tests: | |
119 scripts/test-expression-extractor.sh | |
120 | |
121 Run the Dart Analyzer: | |
122 ./scripts/analyze.sh | |
123 ``` | |
124 | |
125 To run Karma tests over Dartium, execute the following shell commands (which | |
126 will launch the Karma server): | |
127 | |
128 ```shell | |
129 . ./scripts/env.sh | |
130 node "node_modules/karma/bin/karma" start karma.conf \ | |
131 --reporters=junit,dots --port=8765 --runner-port=8766 \ | |
132 --browsers=Dartium | |
133 ``` | |
134 | |
135 In another shell window or tab, or from your favorite IDE, launch the Karma | |
136 tests proper by executing: | |
137 | |
138 ```shell | |
139 . ./scripts/env.sh | |
140 karma_run.sh | |
141 ``` | |
142 | |
143 **Note:**: If the dart analyzer fails with warnings, the tests will not run. | |
144 You can manually run the tests if this happens: | |
145 | |
146 ```shell | |
147 karma run --port=8765 | |
148 ``` | |
149 | |
150 ## Debugging | |
151 | |
152 In the dart editor you can configure a dartium launch target for the karma test
runner debug page. | |
153 The menu option is under Run > Manage Launches > Create new Dartium Launch. | |
154 | |
155 ``` | |
156 http://localhost:8765/debug.html | |
157 ``` | |
158 | |
159 If you want to only run a single test you can alter the test you wish to run by
changing `it` to `iit` | |
160 or `describe` to `ddescribe`. This will only run that individual test and make i
t much easier to debug. | |
161 | |
162 | |
163 ## Continuous Integration using Travis | |
164 | |
165 See the instructions given [here](https://github.com/angular/angular.dart/blob/m
aster/travis.md). | |
166 | |
167 ----- | |
OLD | NEW |