Skip to content

Commit 63b38fb

Browse files
committed
Updated README to document options.
I did this because I previously neglected to update the README with all the details about the various command line options that have been added to snapdragon.
1 parent 62c25d4 commit 63b38fb

File tree

1 file changed

+97
-3
lines changed

1 file changed

+97
-3
lines changed

README.markdown

+97-3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,30 @@ $ snapdragon spec/javascripts
138138
$ snapdragon spec/javascript custom_js/tests/foo_spec.js custom_js/test/bar_spec.js
139139
```
140140

141+
#### Run test files matched by default pattern (`spec/**/*_spec.js`)
142+
143+
```text
144+
$ snapdragon
145+
```
146+
147+
#### Run test files matched by custom pattern
148+
149+
The following is an example command that specifies a custom pattern to use to
150+
match test files to run. Please note the double quote marks around the
151+
pattern. These are necessary as without them most shells will try and resolve
152+
the pattern for you. Further details on the glob syntax can be found
153+
[here](http://ruby-doc.org/core-2.0.0/Dir.html#method-c-glob).
154+
155+
```text
156+
$ snapdragon -P "spec/assets/javascripts/foo/*_spec.js"
157+
```
158+
159+
#### Output Usage Details/Help
160+
161+
```text
162+
$ snapdragon --help
163+
```
164+
141165
## Usage (snapdragon_server)
142166

143167
The *snapdragon_server* command allows you to run your
@@ -157,13 +181,13 @@ The following runs the describe or it block that corresponds to line number
157181
$ snapdragon_server spec/javascript/foo_spec.js:23
158182
```
159183

160-
#### Run specific spec files
184+
#### Run an entire spec file(s)
161185

162186
```text
163187
$ snapdragon_server spec/javascript/foo_spec.js spec/javascript/bar_spec.js
164188
```
165189

166-
#### Run all the specs in directories
190+
#### Run an entire directory of spec files
167191

168192
The following recursively explores the given directories contents for
169193
files that end in `spec.js` or `Spec.js` and runs the tests in the identified
@@ -173,12 +197,82 @@ spec files.
173197
$ snapdragon_server spec/javascript custom_js/specs
174198
```
175199

176-
#### Combine files and directories
200+
#### Run combination of files and directories
177201

178202
```text
179203
$ snapdragon_server spec/javascript custom_js/tests/foo_spec.js custom_js/test/bar_spec.js
180204
```
181205

206+
#### Run test files matched by default pattern (`spec/**/*_spec.js`)
207+
208+
```text
209+
$ snapdragon_server
210+
```
211+
212+
#### Run test files matched by custom pattern
213+
214+
The following is an example command that specifies a custom pattern to use to
215+
match test files to run. Please note the double quote marks around the
216+
pattern. These are necessary as without them most shells will try and resolve
217+
the pattern for you. Further details on the glob syntax can be found
218+
[here](http://ruby-doc.org/core-2.0.0/Dir.html#method-c-glob).
219+
220+
```text
221+
$ snapdragon_server -P "spec/assets/javascripts/foo/*_spec.js"
222+
```
223+
224+
#### Output Usage Details/Help
225+
226+
```text
227+
$ snapdragon_server --help
228+
```
229+
230+
### Additional Options
231+
232+
Below is a listing of the various options that can be passed to either the
233+
`snapdragon` or `snapdragon_server` commands.
234+
235+
#### Version (`-v`, `--version`)
236+
237+
When given this option it will output the version that you are using
238+
and exit without running any tests.
239+
240+
#### Help (`-h`, `--help`)
241+
242+
When given this option it will output basic usage summary and exit without
243+
running any tests.
244+
245+
#### Format (`-f FORMAT`, `--format FORMAT`)
246+
247+
This option allows you to specify the output format of the tests. By default
248+
it outputs using the `console` format. This option is extremely useful when
249+
you would like to use `snapdragon` inside of a CI process because you can
250+
instruct it to output in other formats such as `junit` which CI services
251+
can parse.
252+
253+
The following are the currently supported `FORMAT` values.
254+
255+
* `console` (default)
256+
* `junit`
257+
258+
#### Color (`--no-color`, `--no-colour`)
259+
260+
If you would like to disable ANSI color output which is enabled by default,
261+
include either the `--no-color` or `--no-colour` option.
262+
263+
#### Pattern (`-P PATTERN`, `--pattern PATTERN`)
264+
265+
When this option is not given and no file or directory paths are given it
266+
uses the default pattern `"spec/**/*_spec.js"`.
267+
268+
When given this option without any explicit file paths or directory paths it
269+
will use the provided glob pattern to identify which test files to run. Any
270+
example usage of this option can be seen above in the *Run test files matched
271+
by custom pattern* section. For more details on the glob pattern syntax please
272+
refer to the [Ruby
273+
Dir.glob](http://ruby-doc.org/core-2.0.0/Dir.html#method-c-glob)
274+
documentation.
275+
182276
## // require_relative() directive
183277

184278
Snapdragon also provides a `// require_relative()` directive that the

0 commit comments

Comments
 (0)