]> khamidou — GitHub mirrors - electron.git/commitdiff
Monitor file events in pathwatcher spec.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 9 Jan 2014 14:13:48 +0000 (22:13 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 9 Jan 2014 14:13:48 +0000 (22:13 +0800)
spec/modules-spec.coffee

index 52936ef436912dad1eac6fe99bf0d3adcec97b6b..ef4d742b17db00e75321f5e4ff1ee01337520046 100644 (file)
@@ -22,8 +22,11 @@ describe 'third-party module', ->
     it 'emits file events correctly', (done) ->
       pathwatcher = require 'pathwatcher'
       temp.mkdir 'dir', (err, dir) ->
-        watcher = pathwatcher.watch dir, (event) ->
+        assert err == null
+        file = path.join dir, 'file'
+        fs.writeFileSync file, 'content'
+        watcher = pathwatcher.watch file, (event) ->
           assert.equal event, 'change'
           watcher.close()
           done()
-        fs.writeFile path.join(dir, 'file'), ->
+        fs.writeFileSync file, 'content2'