Add spec for pathwatcher module.
This commit is contained in:
parent
c76f510cea
commit
a12754f980
2 changed files with 15 additions and 1 deletions
|
@ -6,9 +6,11 @@
|
||||||
"coffee-script": "~1.6.3",
|
"coffee-script": "~1.6.3",
|
||||||
"coffeelint": "~0.6.1",
|
"coffeelint": "~0.6.1",
|
||||||
"mocha": "~1.13.0",
|
"mocha": "~1.13.0",
|
||||||
|
"pathwatcher": "0.13.0",
|
||||||
"walkdir": "~0.0.7",
|
"walkdir": "~0.0.7",
|
||||||
"runas": "0.3.0",
|
"runas": "0.3.0",
|
||||||
"formidable": "~1.0.14"
|
"formidable": "~1.0.14",
|
||||||
|
"temp": "~0.6.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
assert = require 'assert'
|
assert = require 'assert'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
|
temp = require 'temp'
|
||||||
|
|
||||||
describe 'third-party module', ->
|
describe 'third-party module', ->
|
||||||
fixtures = path.join __dirname, 'fixtures'
|
fixtures = path.join __dirname, 'fixtures'
|
||||||
|
temp.track()
|
||||||
|
|
||||||
describe 'runas', ->
|
describe 'runas', ->
|
||||||
it 'can be required in renderer', ->
|
it 'can be required in renderer', ->
|
||||||
|
@ -15,3 +17,13 @@ describe 'third-party module', ->
|
||||||
child.on 'message', (msg) ->
|
child.on 'message', (msg) ->
|
||||||
assert.equal msg, 'ok'
|
assert.equal msg, 'ok'
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
describe 'pathwatcher', ->
|
||||||
|
it 'emits file events correctly', (done) ->
|
||||||
|
pathwatcher = require 'pathwatcher'
|
||||||
|
temp.mkdir 'dir', (err, dir) ->
|
||||||
|
watcher = pathwatcher.watch dir, (event) ->
|
||||||
|
assert.equal event, 'change'
|
||||||
|
watcher.close()
|
||||||
|
done()
|
||||||
|
fs.writeFile path.join(dir, 'file'), ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue