Permalink
Browse files

Fixing a few more node v0.8 issues.

  • Loading branch information...
1 parent a373cfd commit a8fc09b31fb92f5b3f6ec6db425ed3e548a931e1 @andrerod andrerod committed Jul 10, 2012
Showing with 21 additions and 8 deletions.
  1. +5 −2 test/runjshint.js
  2. +6 −2 test/runtests.js
  3. +10 −4 test/serviceruntime/roleenvironment-tests.js
View
7 test/runjshint.js
@@ -14,7 +14,6 @@
*/
var fs = require('fs');
-var path = require('path');
var walk = function (dir, done) {
var results = [];
@@ -42,8 +41,12 @@ var walk = function (dir, done) {
var jshint = require('../node_modules/jshint/packages/jshint/jshint');
+if (!fs.existsSync) {
+ fs.existsSync = require('path').existsSync;
+}
+
var libDir = '../lib';
-if (!path.existsSync(libDir + '/azure.js')) {
+if (!fs.existsSync(libDir + '/azure.js')) {
libDir = './lib';
}
View
8 test/runtests.js
@@ -14,7 +14,6 @@
*/
var fs = require('fs');
-var path = require('path');
var args = (process.ARGV || process.argv);
@@ -28,7 +27,12 @@ var testList = args.pop();
var fileContent;
var root = false;
-if (path.existsSync(testList)) {
+
+if (!fs.existsSync) {
+ fs.existsSync = require('path').existsSync;
+}
+
+if (fs.existsSync(testList)) {
fileContent = fs.readFileSync(testList).toString();
} else {
fileContent = fs.readFileSync('./test/' + testList).toString();
View
14 test/serviceruntime/roleenvironment-tests.js
@@ -82,6 +82,12 @@ function setupGoalStateEndpoint () {
suite('roleenvironment-tests', function () {
setup(function (done) {
+ // Temporary fix for node version < 0.8, starting from v0.8
+ // path.existsSync has been deprecated.
+ if (!fs.existsSync) {
+ fs.existsSync = path.existsSync;
+ }
+
// Set windows azure runtime endpoint
originalWaRuntimeEndpoint = process.env['WaRuntimeEndpoint'];
process.env['WaRuntimeEndpoint'] = versionsEndpointPath;
@@ -105,19 +111,19 @@ suite('roleenvironment-tests', function () {
runtimeKernel.protocol1RuntimeGoalStateClient.currentEnvironmentData = null;
runtimeKernel.protocol1RuntimeGoalStateClient.currentGoalState = null;
- if (path.existsSync(versionsEndpointPath)) {
+ if (fs.existsSync(versionsEndpointPath)) {
fs.unlinkSync(versionsEndpointPath);
}
- if (path.existsSync(goalStatePath)) {
+ if (fs.existsSync(goalStatePath)) {
fs.unlinkSync(goalStatePath);
}
- if (path.existsSync(currentStatePath)) {
+ if (fs.existsSync(currentStatePath)) {
fs.unlinkSync(currentStatePath);
}
- if (path.existsSync(roleEnvironmentPath)) {
+ if (fs.existsSync(roleEnvironmentPath)) {
fs.unlinkSync(roleEnvironmentPath);
}

0 comments on commit a8fc09b

Please sign in to comment.