Permalink
Browse files

Don't use require.paths

node will remove this at some point, let's get rid of it.
  • Loading branch information...
1 parent 230d0d3 commit eb4468be17f438be9bef36fe8e4f83661d6267eb @felixge committed Apr 13, 2011
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -1,21 +1,16 @@
var path = require('path'),
fs = require('fs');
-require.paths.unshift(path.dirname(__dirname)+'/lib');
-var util = require('formidable/util');
-
try {
global.Gently = require('gently');
} catch (e) {
throw new Error('this test suite requires node-gently');
}
+exports.lib = path.join(__dirname, '../lib');
+
global.GENTLY = new Gently();
-global.puts = util.puts;
-global.p = function() {
- util.error(util.inspect.apply(null, arguments));
-};
global.assert = require('assert');
global.TEST_PORT = 13532;
global.TEST_FIXTURES = path.join(__dirname, 'fixture');
@@ -1,6 +1,6 @@
-require('../common');
+var common = require('../common');
var CHUNK_LENGTH = 10,
- multipartParser = require('formidable/multipart_parser'),
+ multipartParser = require(common.lib + '/multipart_parser'),
MultipartParser = multipartParser.MultipartParser,
parser = new MultipartParser(),
fixtures = require('../fixture/multipart'),
@@ -1,7 +1,7 @@
-require('../common');
+var common = require('../common');
var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
-var File = require('formidable/file'),
+var File = require(common.lib + '/file'),
EventEmitter = require('events').EventEmitter,
file,
gently;
@@ -1,10 +1,10 @@
-require('../common');
+var common = require('../common');
var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'),
QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'),
EventEmitterStub = GENTLY.stub('events', 'EventEmitter'),
FileStub = GENTLY.stub('./file');
-var formidable = require('formidable'),
+var formidable = require(common.lib + '/index'),
IncomingForm = formidable.IncomingForm,
events = require('events'),
fs = require('fs'),
@@ -1,5 +1,5 @@
-require('../common');
-var multipartParser = require('formidable/multipart_parser'),
+var common = require('../common');
+var multipartParser = require(common.lib + '/multipart_parser'),
MultipartParser = multipartParser.MultipartParser,
events = require('events'),
Buffer = require('buffer').Buffer,
@@ -1,5 +1,5 @@
-require('../common');
-var QuerystringParser = require('formidable/querystring_parser').QuerystringParser,
+var common = require('../common');
+var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser,
Buffer = require('buffer').Buffer,
gently,
parser;
@@ -1,10 +1,10 @@
-require('../common');
+var common = require('../common');
var BOUNDARY = '---------------------------10102754414578508781458777923',
FIXTURE = TEST_FIXTURES+'/multi_video.upload',
fs = require('fs'),
- util = require('formidable/util'),
+ util = require(common.lib + '/util'),
http = require('http'),
- formidable = require('formidable'),
+ formidable = require(common.lib + '/index'),
server = http.createServer();
server.on('request', function(req, res) {

0 comments on commit eb4468b

Please sign in to comment.