Permalink
Browse files

Merge pull request #14 from rodzyn/master

require.paths removed
  • Loading branch information...
2 parents 8e1a47c + d6cfb29 commit 30d916311e6742ab9775f016551f17d68cc0b2df Marcin Bunsch committed Jan 12, 2012
View
@@ -1,16 +1,9 @@
#!/usr/bin/env node
// Load jessie
-var path = require('path');
-var sys = require('sys');
-var fs = require('fs');
-var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
-require.paths.push(lib)
-require.paths.push(process.cwd() + '/spec')
-
-var jessie = require(path.join(lib, 'jessie'));
+var jessie = require('../lib/jessie');
// Load package.json
-var pkgsrc = fs.readFileSync(__dirname + '/../package.json');
+var pkgsrc = require('fs').readFileSync(__dirname + '/../package.json');
var pkg = JSON.parse(pkgsrc)
// Enable cli and set version name based on package.json
@@ -24,15 +17,15 @@ cli.parse({
}, null);
process.on('uncaughtException', function (err) {
- var ansi = require('jessie/ansi')
+ var ansi = require('../lib/jessie/ansi')
console.log(ansi.red + "Jessie failed to start. Here's some info about the problem:"+ansi.none)
console.log(err.stack);
});
// Main loop
cli.main(function(args, options) {
if (args.length == 0) {
- sys.puts(cli.getUsage())
+ require('util').puts(cli.getUsage())
process.exit(1)
}
jessie.run(args, options, function(fail) {
View
@@ -1,6 +1,6 @@
-require('jessie/jasmine')
-exports.sugar = require('jessie/sugar').sugar
-exports.runner = require('jessie/runner').runner
+require('./jessie/jasmine')
+exports.sugar = require('./jessie/sugar').sugar
+exports.runner = require('./jessie/runner').runner
exports.include = function(filename) {
var src = require('fs').readFileSync(filename + '.js');
@@ -1,6 +1,6 @@
-var sys = require('sys')
+var sys = require('util')
var fs = require('fs')
-var ansi = require('jessie/ansi')
+var ansi = require('../ansi')
exports.formatter = {
start: function() {
@@ -1,6 +1,6 @@
-var sys = require('sys')
+var sys = require('util')
var fs = require('fs')
-var ansi = require('jessie/ansi')
+var ansi = require('../ansi')
exports.formatter = {
spec: function(result, spec) {
@@ -1,4 +1,4 @@
-var sys = require('sys');
+var sys = require('util');
exports.formatter = {
specStart: function(spec) {
View
@@ -1,15 +1,15 @@
var fs = require('fs');
-var sys = require('sys')
-var ansi = require('jessie/ansi')
+var sys = require('util')
+var ansi = require('./ansi')
exports.reporter = function(format, callback) {
format = format || 'progress'
this.callback = callback
try {
- this.formatter = require('jessie/formatters/' + format).formatter
+ this.formatter = require('./formatters/' + format).formatter
} catch(e) {
sys.puts(ansi.red + "Failed to load " + format + " formatter. Defaulting to progress formatter" + ansi.none)
- this.formatter = require('jessie/formatters/progress').formatter
+ this.formatter = require('./formatters/progress').formatter
}
var formatter = this.formatter
this.formatter.reporter = this;
View
@@ -1,7 +1,7 @@
exports.runner = function(args, options, callback) {
this.jasmine = jasmine.getEnv();
- this.finder = new (require('jessie/finder')).finder(),
- this.reporter = new (require('jessie/reporter')).reporter(options.format, callback)
+ this.finder = new (require('./finder')).finder(),
+ this.reporter = new (require('./reporter')).reporter(options.format, callback)
this.run = function() {
var specs = this.finder.find(args, process.cwd())
var runner = this;
View
@@ -1,5 +1,5 @@
var StdoutCapture = function() {
- var sys = require('sys')
+ var sys = require('util')
var originals = {
puts: sys.puts,
print: sys.print
View
@@ -1,6 +1,6 @@
describe('jessie.ansi', function() {
- var ansi = require('jessie/ansi')
+ var ansi = require('../../lib/jessie/ansi')
it('should have proper red', function() {
ansi.red.should_match(/\033\[31m/)
@@ -1,6 +1,6 @@
describe('jessie.finder', function() {
var path = require('path');
- var finder = new (require('jessie/finder').finder)()
+ var finder = new (require('../../lib/jessie/finder').finder)()
it("should find files if only dir is specified", function() {
finder.find(['spec']).length.should_be(13)
@@ -1,12 +1,12 @@
describe('formatters', function() {
- var reporter = new (require('jessie/reporter')).reporter('nested')
+ var reporter = new (require('../../../lib/jessie/reporter')).reporter('nested')
describe('nested formatter', function() {
describe('single spec', function() {
it("should use the green spec description to render a successful spec", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({fail: false}, {description: 'my spec'})
})
capture.output().should_match('my spec')
@@ -15,7 +15,7 @@ describe('formatters', function() {
it("should use the red spec description to render a failing spec", function() {
var original_depth = reporter.formatter.depth
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({fail: true}, {description: 'my spec'})
})
capture.output().should_match('my spec')
@@ -25,7 +25,7 @@ describe('formatters', function() {
it("should use the yellow spec description to render a pending spec", function() {
var original_depth = reporter.formatter.depth
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({pending: true}, {description: 'my spec'})
})
capture.output().should_match('my spec')
@@ -36,13 +36,13 @@ describe('formatters', function() {
it("should render the spec with appropriate spacing on the left", function() {
var original_depth = reporter.formatter.depth
reporter.formatter.depth = 1
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.specStart({description: 'my spec'})
reporter.formatter.spec({fail: true}, {description: 'my spec'})
})
capture.output().should_match(/^ {2}/)
reporter.formatter.depth = 2
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.specStart({description: 'my spec'})
reporter.formatter.spec({fail: true}, {description: 'my spec'})
})
@@ -57,7 +57,7 @@ describe('formatters', function() {
it("should render the suite name", function() {
var original_depth = reporter.formatter.depth
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.suiteStart({description: 'my suite'})
})
capture.output().should_match('my suite')
@@ -69,7 +69,7 @@ describe('formatters', function() {
var original_depth = reporter.formatter.depth
reporter.formatter.depth = 1
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.suiteStart({description: 'my suite'})
})
@@ -80,7 +80,7 @@ describe('formatters', function() {
reporter.formatter.depth.should_be(1)
reporter.formatter.depth = 2
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.suiteStart({description: 'my suite'})
})
capture.output().should_match(/^ {4}/)
@@ -94,7 +94,7 @@ describe('formatters', function() {
reporter.formatter.depth = 1
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.suiteStart({description: 'my suite'})
})
@@ -125,7 +125,7 @@ describe('formatters', function() {
}]
it("should properly render a summary", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -146,7 +146,7 @@ describe('formatters', function() {
stacktrace: ['Expected A to be B', 'file.js:23:2', 'another_file.js:30:11']
}]
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -167,7 +167,7 @@ describe('formatters', function() {
stacktrace: ['Expected A to be B', 'file.js:23:2', 'another_file.js:30:11']
}]
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -1,28 +1,28 @@
describe('formatters', function() {
- var reporter = new (require('jessie/reporter')).reporter('progress')
+ var reporter = new (require('../../../lib/jessie/reporter')).reporter('progress')
describe('progress formatter', function() {
describe('single spec', function() {
it("should use a dot to render a successful spec", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({fail: false})
})
capture.output().should_match('.')
capture.output().should_match(/\033\[32m/) // green
})
it("should use a star to render a pending spec", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({pending: true})
})
capture.output().should_match(/\*/)
capture.output().should_match(/\033\[33m/) // yellow
})
it("should use a F to render a failed spec", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.spec({fail: true})
})
capture.output().should_match('F')
@@ -40,7 +40,7 @@ describe('formatters', function() {
}]
it("should properly render a summary", function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -61,7 +61,7 @@ describe('formatters', function() {
stacktrace: ['Expected A to be B', 'file.js:23:2', 'another_file.js:30:11']
}]
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -82,7 +82,7 @@ describe('formatters', function() {
stacktrace: ['Expected A to be B', 'file.js:23:2', 'another_file.js:30:11']
}]
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
reporter.formatter.finish(result)
})
@@ -10,7 +10,7 @@ function specsAsArray(output) {
}
describe('XUnit formatter', function() {
- var formatter = new (require('jessie/reporter')).reporter('xunit').formatter
+ var formatter = new (require('../../../lib/jessie/reporter')).reporter('xunit').formatter
var knownResults;
var emptyRunner;
@@ -41,7 +41,7 @@ describe('XUnit formatter', function() {
});
it('should add an open testsuite tag with the summary in the first position of the output buffer', function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
formatter.finish(knownResults, emptyRunner);
});
var tag = outputAsArray(capture.output())[0];
@@ -56,7 +56,7 @@ describe('XUnit formatter', function() {
});
it('should have the last tag as a close testsuite tag', function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
formatter.finish(knownResults, emptyRunner);
});
var output = outputAsArray(capture.output());
@@ -65,7 +65,7 @@ describe('XUnit formatter', function() {
});
it('should add an open tastcase tag with the summary to the output buffer for successful specs', function() {
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
formatter.finish(knownResults, runnerWithOneSpec);
});
var tag = specsAsArray(capture.output())[0];
@@ -78,7 +78,7 @@ describe('XUnit formatter', function() {
it('should add the reasons of a pended spec to the output buffer', function() {
runnerWithOneSpec.suites()[0].specs()[0].results().getItems()[0].pending = true;
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
formatter.finish(knownResults, runnerWithOneSpec);
});
var tag = specsAsArray(capture.output())[0];
@@ -89,7 +89,7 @@ describe('XUnit formatter', function() {
it('should add the reasons of a failed spec to the output buffer', function() {
runnerWithOneSpec.suites()[0].specs()[0].results().failedCount = 1;
- capture = require('helpers/stdout').capture(function() {
+ capture = require('../../helpers/stdout').capture(function() {
formatter.finish(knownResults, runnerWithOneSpec);
});
var tag = specsAsArray(capture.output())[0];
Oops, something went wrong.

0 comments on commit 30d9163

Please sign in to comment.