Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions test/test-local.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*global describe:false, it:false */

var expect = require('chai').expect;
var platform = require('os').platform();

describe('vfs-local', function () {

Expand Down Expand Up @@ -361,11 +362,14 @@ describe('vfs-local', function () {
done();
});
});
it("should error with EISDIR if the path is a directory", function (done) {
it("should error with EISDIR if the path is a directory (or EPERM on darwin)", function (done) {
var vpath = "/dir";
expect(fs.existsSync(base + vpath)).ok;
vfs.rmfile(vpath, {}, function (err, meta) {
expect(err).property("code").equal("EISDIR");
if (platform === "darwin")
expect(err).property("code").equal("EPERM");
else
expect(err).property("code").equal("EISDIR");
done();
});
});
Expand Down Expand Up @@ -518,7 +522,9 @@ describe('vfs-local', function () {
watcher.on("change", function (event, filename) {
watcher.close();
expect(event).equal("change");
expect(filename).equal(vpath.substr(1));
// filename not available on OS X: http://nodejs.org/api/fs.html#fs_filename_argument
if (platform !== "darwin")
expect(filename).equal(vpath.substr(1));
writable.end();
writable.on("close", function () {
fs.unlinkSync(base + vpath);
Expand All @@ -535,14 +541,21 @@ describe('vfs-local', function () {
if (err) throw err;
expect(meta).property("watcher").ok;
var watcher = meta.watcher;
watcher.on("change", function (event, filename) {
watcher.close();
expect(event).ok;
expect(filename).equal(vpath.substr(1));
fs.unlinkSync(base + vpath);

// this whole test does not work on OS X
if (platform !== "darwin") {
watcher.on("change", function (event, filename) {
console.log("BLURB2");
watcher.close();
expect(event).ok;
fs.unlinkSync(base + vpath);
done();
});
fs.writeFileSync(base + vpath, "newfile!");
}
else {
done();
});
fs.writeFileSync(base + vpath, "newfile!");
}
});
});
it("should return error if path does not exist", function(done) {
Expand Down