Skip to content
Myr

node.js

This file

Path

spec/node.js

65 lines · 1.2 KiB · JavaScript

Last changed by

Specs can now run independant specs for those who cant build deps. Closes #127visionmediabefore adoptiona09c773

History of this file

Take it

Updated to JSpec 3.0.0visionmediabefore adoption694572b

lines 1–10why, one step back
1
2require.paths.unshift('spec', 'lib', 'spec/lib', 'spec/support/libxmljs')3require("jspec")4require("express")5require("express/spec")67quit = process.exit8print = puts910readFile = function(path) {

Refactored node spec runnervisionmediabefore adoption6f995d0

lines 11–16why, one step back
11 var result
12 require('posix')13 .cat(path, "utf8")14 .addCallback(function(contents){ result = contents })15 .addErrback(function(){ throw new Error("failed to read file `" + path + "'") })16 .wait()

Updated to JSpec 3.0.0visionmediabefore adoption694572b

lines 17–19why, one step back
17 return result
18}19

Specs can now run independant specs for those who cant build deps. Closes #127visionmediabefore adoptiona09c773

lines 20–65why, one step back
20function run(specs) {
21 specs.forEach(function(spec){22 JSpec.exec('spec/spec.' + spec + '.js')23 })24}2526specs = {27 independant: [28 'core',29 'routing',30 'helpers',31 'request',32 'mime',33 'static',34 'collection',35 'plugins',36 'plugins.view',37 'plugins.common-logger',38 'plugins.content-length',39 'plugins.method-override',40 'plugins.body-decoder',41 'plugins.redirect',42 'plugins.hooks',43 'plugins.cookie',44 ],45 dependant: [46 'element-collection'47 ]48}4950switch (process.ARGV[2]) {51 case 'independant':52 run(specs.independant)53 break54 case 'dependant':55 run(specs.dependant)56 break57 case 'all':58 run(specs.independant)59 run(specs.dependant)60 break61 default: 62 run([process.ARGV[2]])63}6465JSpec.run({ reporter: JSpec.reporters.Terminal, failuresOnly: true }).report()