Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c2b6e12

Browse files
committed
docs(contribute): update misc/contribute docs with Testacular info
1 parent 06eceeb commit c2b6e12

File tree

2 files changed

+71
-51
lines changed

2 files changed

+71
-51
lines changed

Rakefile

+17-3
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ task :package => [:clean, :minify, :version, :docs] do
170170
end
171171

172172

173-
desc 'Run all AngularJS tests'
174-
task :test, :browsers, :misc_options do |t, args|
173+
desc 'Start development webserver'
174+
task :webserver, :port do |t, args|
175+
system "node lib/nodeserver/server.js #{args[:port]}"
176+
end
175177

176-
puts args
177178

179+
desc 'Run all AngularJS tests'
180+
task :test, :browsers, :misc_options do |t, args|
178181
[ 'test:jqlite',
179182
'test:jquery',
180183
'test:modules',
@@ -187,6 +190,17 @@ end
187190

188191
namespace :test do
189192

193+
desc 'Run all unit tests (single run)'
194+
task :unit, :browsers, :misc_options do |t, args|
195+
[ 'test:jqlite',
196+
'test:jquery',
197+
'test:modules'
198+
].each do |task|
199+
Rake::Task[task].invoke(args[:browsers], args[:misc_options])
200+
end
201+
end
202+
203+
190204
desc 'Run jqLite-based unit test suite (single run)'
191205
task :jqlite, :browsers, :misc_options do |t, args|
192206
start_testacular('testacular-jqlite.conf.js', true, args[:browsers], args[:misc_options])

docs/content/misc/contribute.ngdoc

+54-48
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
<a name="H1_1"></a>
1414
# License
1515

16-
`Angular` is an open source project licensed under the {@link
16+
AngularJS is an open source project licensed under the {@link
1717
http://github.com/angular/angular.js/blob/master/LICENSE MIT license}. Your contributions are
18-
always welcome. When working with `angular` source base, please follow the guidelines provided on
18+
always welcome. When working with AngularJS code base, please follow the guidelines provided on
1919
this page.
2020

2121

2222
<a name="H1_2"></a>
2323
# Contributing to Source Code
2424

25-
We'd love for you to contribute to our source code and to make `angular` even better than it is
26-
today! Here are the guidelines we'd like you to use:
25+
We'd love for you to contribute to our source code and to make AngularJS even better than it is
26+
today! Here are the guidelines we'd like you to follow:
2727

28-
* Major changes that you intend to contribute to the project must be discussed first on our {@link
28+
* Major changes that you intend to contribute to the project should be discussed first on our {@link
2929
https://groups.google.com/forum/?hl=en#!forum/angular mailing list} so that we can better
3030
coordinate our efforts, prevent duplication of work, and help you to craft the change so that it
3131
is successfully accepted upstream.
@@ -64,45 +64,43 @@ inheritance only when absolutely necessary.
6464
external API. See our existing code to see what we mean.
6565

6666
* We don't go crazy with type annotations for private internal APIs unless it's an internal API
67-
that is used throughout `angular`. The best guidance is to do what makes the most sense.
67+
that is used throughout AngularJS. The best guidance is to do what makes the most sense.
6868

6969

7070
<a name="H1_4"></a>
7171
# Checking Out and Building Angular
7272

73-
The `angular` source code is hosted at {@link http://github.com Github}, which we also use to
74-
accept code contributions. Several steps are needed to check out and build `angular`:
73+
The AngularJS source code is hosted at {@link http://github.com Github}, which we also use to
74+
accept code contributions. Several steps are needed to check out and build AngularJS:
7575

7676

7777
## Installation Dependencies
7878

79-
Before you can build `angular`, you must install or configure the following dependencies on your
79+
Before you can build AngularJS, you must install or configure the following dependencies on your
8080
machine:
8181

8282
* {@link http://rake.rubyforge.org Rake}: We use Rake as our build system, which is pre-installed
8383
on most Macintosh and Linux machines. If that is not true in your case, you can grab it from the
8484
Rake website.
8585

86+
* Git: The {@link http://help.github.com/mac-git-installation Github Guide to Installing Git} is
87+
quite a good source for information on Git.
88+
8689
* {@link http://nodejs.org Node.js}: We use Node to generate the documentation and to run a
8790
development web server. Depending on your system, you can install Node either from source or as a
8891
pre-packaged bundle.
8992

90-
You'll also need npm and the following npm modules:
93+
Once installed, you'll also need several npms (node packages), which you can install once you checked out a local copy
94+
of the Angular repository (see below) with:
9195

92-
* install npm: `curl http://npmjs.org/install.sh | sh`
93-
* install q: `npm install q`
94-
* install qq: `npm install qq`
95-
* install q-fs: `npm install q-fs`
96-
* install jasmine-node: `npm install jasmine`
96+
* `cd angular.js`
97+
* `npm install`
9798

9899

100+
* Lastly, you'll also need Testacular our spectacular test runner that we use for running unit and end-to-end tests.
99101

100-
* Java: The Java runtime is used to run {@link http://code.google.com/p/js-test-driver
101-
JsTestDriver} (JSTD), which we use to run our unit test suite. JSTD binaries are part of the
102-
`angular` source base, which means there is no need to install or configure it separately.
102+
* `sudo npm install -g testacular`
103103

104-
* Git: The {@link http://help.github.com/mac-git-installation Github Guide to Installing Git} is
105-
quite a good source for information on Git.
106104

107105

108106
## Creating a Github Account and Forking Angular
@@ -112,31 +110,31 @@ Afterwards, go ahead and {@link http://help.github.com/forking fork} the {@link
112110
https://github.com/angular/angular.js main angular repository}.
113111

114112

115-
## Building `Angular`
113+
## Building AngularJS
116114

117-
To build `angular`, you check out the source code and use Rake to generate the non-minified and
118-
minified `angular` files:
115+
To build AngularJS, you check out the source code and use Rake to generate the non-minified and
116+
minified AngularJS files:
119117

120118
1. To clone your Github repository, run:
121119

122120
git clone [email protected]:<github username>/angular.js.git
123121

124-
2. To go to the `angular` directory, run:
122+
2. To go to the AngularJS directory, run:
125123

126124
cd angular.js
127125

128-
3. To add the main `angular` repository as an upstream remote to your repository, run:
126+
3. To add the main AngularJS repository as an upstream remote to your repository, run:
129127

130128
git remote add upstream https://github.com/angular/angular.js.git
131129

132-
4. To build `angular`, run:
130+
4. To build AngularJS, run:
133131

134132
rake package
135133

136134
The build output can be located under the `build` directory. It consists of the following files and
137135
directories:
138136

139-
* `angular-<version>.tgz` — This is the complete tarball, which contains all of the release build
137+
* `angular-<version>.zip` — This is the complete zip file, which contains all of the release build
140138
artifacts.
141139

142140
* `angular.js` — The non-minified `angular` script.
@@ -145,69 +143,77 @@ artifacts.
145143

146144
* `angular-scenario.js` — The `angular` End2End test runner.
147145

148-
* `angular-ie-compat.js` — The Internet Explorer compatibility patch file.
149-
150146
* `docs/` — A directory that contains all of the files needed to run `docs.angularjs.org`.
151147

152148
* `docs/index.html` — The main page for the documentation.
153149

154150
* `docs/docs-scenario.html` — The End2End test runner for the documentation application.
155151

156152

153+
<a name="webserver"></a>
157154
## Running a Local Development Web Server
158155

159-
To debug or test code, it is often useful to have a local HTTP server. For this purpose, we have
156+
To debug code and run end-to-end tests, it is often useful to have a local HTTP server. For this purpose, we have
160157
made available a local web server based on Node.js.
161158

162159
1. To start the web server, run:
163160

164-
./nodeserver.sh
161+
rake webserver
165162

166163
2. To access the local server, go to this website:
167164

168165
http://localhost:8000/
169166

170-
By default, it serves the contents of the `angular` project directory.
167+
By default, it serves the contents of the AngularJS project directory.
171168

172169

173170
<a name="unit-tests"></a>
174171
## Running the Unit Test Suite
175172

176-
Our unit and integration tests are written with Jasmine and executed with JsTestDriver. To run the
177-
tests:
173+
Our unit and integration tests are written with Jasmine and executed with Testacular. To run all of the
174+
tests once on Chrome run:
178175

179-
1. To start the JSTD server, run:
176+
rake test:unit
180177

181-
./server.sh
178+
To run the tests on other browsers (Chrome, ChromeCanary, Firefox, Opera and Safari are pre-configured) use:
182179

183-
2. To capture one or more browsers, go to this website:
180+
rake test:unit[Opera+Firefox]
181+
182+
During development it's however more productive to continuously run unit tests every time the source or test files
183+
change. To execute tests in this mode run:
184+
185+
1. To start the Testacular server, capture Chrome browser and run unit tests, run:
186+
187+
rake test:jqlite
188+
189+
2. To capture more browsers, open this url in the desired browser (url might be different if you have multiple instance
190+
of Testacular running, read Testacular's console output for the correct url):
184191

185192
http://localhost:9876/
186193

187-
3. To trigger a test execution, run:
194+
3. To re-run tests just change any source or test file.
188195

189-
./test.sh
190196

191-
4. To automatically run the test suite each time one or more of the files in the project directory
192-
is changed, you can install `watchr` and then run:
197+
To learn more about all of the preconfigured Rake tasks run:
193198

194-
watchr watchr.rb
199+
rake -T
195200

196-
5. To view the output of each test run, you can tail this log file:
197201

198-
./logs/jstd.log
202+
## Running the end-to-end Test Suite
199203

204+
To run the E2E test suite:
200205

201-
## Running the End2End Test Suite
206+
1. Start the local web server if it's not running already.
202207

203-
To run the End2End test suite:
208+
rake webserver
204209

205-
1. Start the local web server.
206210
2. In a browser, go to:
207211

208212
http://localhost:8000/build/docs/docs-scenario.html
209213

210-
The tests are executed automatically.
214+
or in terminal run:
215+
216+
rake test:e2e
211217

212218

213219

0 commit comments

Comments
 (0)