Skip to content

Commit

Permalink
tests: make tests work in node v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
bentaber committed Mar 29, 2013
1 parent ef4084a commit d0c2dec
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/test-api.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
var config = require('./config');
path = require('path'),
fs = require('fs'),
dirty = require(config.LIB_DIRTY),
events = require('events'),
assert = require('assert');

// exists moved from path to fs in node v0.7.1
// https://raw.github.com/joyent/node/v0.7.1/ChangeLog
var exists = (fs.exists) ? fs.exists : path.exists;

function dirtyAPITests(file) {
var mode = (file) ? 'persistent' : 'transient';

describe('dirty api (' + mode + ' mode)', function() {
function cleanup() {
if (fs.existsSync(file)) {
fs.unlinkSync(file);
}
function cleanup(done) {
exists(file, function(doesExist) {
if (doesExist) {
fs.unlinkSync(file);
}

done();
});
}

before(cleanup);
Expand Down

0 comments on commit d0c2dec

Please sign in to comment.