Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Specs can now run independant specs for those who cant build deps. Cl…

…oses #127

Use `make test-independant` to ignore element-collection if you are not working on that
  • Loading branch information...
commit a09c773f1bc28e47a673e1029e464d6b7dddd972 1 parent 765c8ae
@tj tj authored
Showing with 61 additions and 24 deletions.
  1. +7 −1 Makefile
  2. +8 −0 Readme.md
  3. +46 −23 spec/node.js
View
8 Makefile
@@ -5,7 +5,13 @@ init: lib/support/js-oo/Readme.md
@git submodule update --init
test: init spec/support/libxmljs/libxmljs.node
- @$(NODE) spec/node.js
+ @$(NODE) spec/node.js all
+
+test-independant: init
+ @$(NODE) spec/node.js independant
+
+test-dependant: init spec/support/libxmljs/libxmljs.node
+ @$(NODE) spec/node.js dependant
app:
@$(NODE) examples/app.js
View
8 Readme.md
@@ -88,6 +88,14 @@ related dependencies such as libxmljs.
$ make test
+To run independant specs (which do not require building of external apis etc) use:
+
+ $ make test-independant
+
+To run dependant specs (which require building of external apis etc) use:
+
+ $ make test-dependant
+
Run individual suites:
$ node spec/node.js core
View
69 spec/node.js
@@ -17,26 +17,49 @@ readFile = function(path) {
return result
}
-if (process.ARGV[2])
- JSpec.exec('spec/spec.' + process.ARGV[2] + '.js')
-else
- JSpec
- .exec('spec/spec.core.js')
- .exec('spec/spec.routing.js')
- .exec('spec/spec.helpers.js')
- .exec('spec/spec.request.js')
- .exec('spec/spec.mime.js')
- .exec('spec/spec.static.js')
- .exec('spec/spec.collection.js')
- .exec('spec/spec.element-collection.js')
- .exec('spec/spec.plugins.js')
- .exec('spec/spec.plugins.view.js')
- .exec('spec/spec.plugins.common-logger.js')
- .exec('spec/spec.plugins.content-length.js')
- .exec('spec/spec.plugins.method-override.js')
- .exec('spec/spec.plugins.body-decoder.js')
- .exec('spec/spec.plugins.redirect.js')
- .exec('spec/spec.plugins.hooks.js')
- .exec('spec/spec.plugins.cookie.js')
-JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: true })
-JSpec.report()
+function run(specs) {
+ specs.forEach(function(spec){
+ JSpec.exec('spec/spec.' + spec + '.js')
+ })
+}
+
+specs = {
+ independant: [
+ 'core',
+ 'routing',
+ 'helpers',
+ 'request',
+ 'mime',
+ 'static',
+ 'collection',
+ 'plugins',
+ 'plugins.view',
+ 'plugins.common-logger',
+ 'plugins.content-length',
+ 'plugins.method-override',
+ 'plugins.body-decoder',
+ 'plugins.redirect',
+ 'plugins.hooks',
+ 'plugins.cookie',
+ ],
+ dependant: [
+ 'element-collection'
+ ]
+}
+
+switch (process.ARGV[2]) {
+ case 'independant':
+ run(specs.independant)
+ break
+ case 'dependant':
+ run(specs.dependant)
+ break
+ case 'all':
+ run(specs.independant)
+ run(specs.dependant)
+ break
+ default:
+ run([process.ARGV[2]])
+}
+
+JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: true }).report()
Please sign in to comment.
Something went wrong with that request. Please try again.