Created
March 31, 2016 08:37
-
-
Save hedefalk/adccbaeb10c7285686d19e9263fda6c5 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
gaze = require 'gaze' | |
temp = (require 'temp').track() | |
path = require 'path' | |
fs = require 'fs' | |
describe 'gaze', -> | |
tempDir = undefined | |
beforeEach -> | |
tempDir = temp.mkdirSync('gaze-test') | |
afterEach -> | |
temp.cleanupSync() | |
testFile = (expectedFile) -> | |
spy = jasmine.createSpy('callback') | |
{dir, base} = path.parse expectedFile | |
gaze('**/*', {cwd: dir}, (err, watcher) -> | |
watcher.on('added', (event, path) -> spy())) | |
fs.writeFile(expectedFile, 'Hello Gaze, see me!', | |
(err) -> throw err if (err)) | |
waitsFor( (-> spy.callCount > 0), "callback wasn't called in time", 5000) | |
it "should notice absolute paths if relativized", -> | |
testFile(path.join process.cwd(), 'foo') | |
it "should notice absolute paths if relativized, even from temp", -> | |
testFile(path.join tempDir, 'foo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first test succeeds even though it takes like 100 secs because my cwd is pretty big. tempDir is empty so this is fast, but fails. No added event is triggered. I guess this might be a dup of shama/gaze#177