Skip to content

Commit 1510116

Browse files
committed
test: fs.watch filename support on Darwin
1 parent b788c5e commit 1510116

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/simple/test-fs-watch.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ var assert = require('assert');
2424
var path = require('path');
2525
var fs = require('fs');
2626

27-
var expectFilePath = process.platform == 'win32' || process.platform == 'linux';
27+
var expectFilePath = process.platform === 'win32' ||
28+
process.platform === 'linux' ||
29+
process.platform === 'darwin';
2830

2931
var watchSeenOne = 0;
3032
var watchSeenTwo = 0;
@@ -63,7 +65,10 @@ assert.doesNotThrow(
6365
var watcher = fs.watch(filepathOne)
6466
watcher.on('change', function(event, filename) {
6567
assert.equal('change', event);
66-
if (expectFilePath) {
68+
69+
// darwin only shows the file path for subdir watching,
70+
// not for individual file watching.
71+
if (expectFilePath && process.platform !== 'darwin') {
6772
assert.equal('watch.txt', filename);
6873
} else {
6974
assert.equal(null, filename);
@@ -87,7 +92,10 @@ assert.doesNotThrow(
8792
function() {
8893
var watcher = fs.watch(filepathTwo, function(event, filename) {
8994
assert.equal('change', event);
90-
if (expectFilePath) {
95+
96+
// darwin only shows the file path for subdir watching,
97+
// not for individual file watching.
98+
if (expectFilePath && process.platform !== 'darwin') {
9199
assert.equal('hasOwnProperty', filename);
92100
} else {
93101
assert.equal(null, filename);

0 commit comments

Comments
 (0)