Created
September 17, 2012 22:45
-
-
Save isaacs/3740247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 182d7b235e26e67210b727e87e7926edc6b3f372 Mon Sep 17 00:00:00 2001 | |
From: isaacs <i@izs.me> | |
Date: Mon, 17 Sep 2012 15:45:37 -0700 | |
Subject: [PATCH] test: fs.watch filename support on Darwin | |
--- | |
test/simple/test-fs-watch.js | 14 +++++++++++--- | |
1 files changed, 11 insertions(+), 3 deletions(-) | |
diff --git a/test/simple/test-fs-watch.js b/test/simple/test-fs-watch.js | |
index 2ad05f2..88c3359 100644 | |
--- a/test/simple/test-fs-watch.js | |
+++ b/test/simple/test-fs-watch.js | |
@@ -24,7 +24,9 @@ var assert = require('assert'); | |
var path = require('path'); | |
var fs = require('fs'); | |
-var expectFilePath = process.platform == 'win32' || process.platform == 'linux'; | |
+var expectFilePath = process.platform === 'win32' || | |
+ process.platform === 'linux' || | |
+ process.platform === 'darwin'; | |
var watchSeenOne = 0; | |
var watchSeenTwo = 0; | |
@@ -63,7 +65,10 @@ assert.doesNotThrow( | |
var watcher = fs.watch(filepathOne) | |
watcher.on('change', function(event, filename) { | |
assert.equal('change', event); | |
- if (expectFilePath) { | |
+ | |
+ // darwin only shows the file path for subdir watching, | |
+ // not for individual file watching. | |
+ if (expectFilePath && process.platform !== 'darwin') { | |
assert.equal('watch.txt', filename); | |
} else { | |
assert.equal(null, filename); | |
@@ -87,7 +92,10 @@ assert.doesNotThrow( | |
function() { | |
var watcher = fs.watch(filepathTwo, function(event, filename) { | |
assert.equal('change', event); | |
- if (expectFilePath) { | |
+ | |
+ // darwin only shows the file path for subdir watching, | |
+ // not for individual file watching. | |
+ if (expectFilePath && process.platform !== 'darwin') { | |
assert.equal('hasOwnProperty', filename); | |
} else { | |
assert.equal(null, filename); | |
-- | |
1.7.5.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment