2019-02-16 11:40:48 -08:00
|
|
|
import Watcher from '../src/watcher'
|
|
|
|
// import to from 'await-to-js'
|
|
|
|
import { expect } from 'chai'
|
|
|
|
import { it } from 'mocha'
|
|
|
|
|
|
|
|
describe('Watcher Class Testing ',async ()=> {
|
|
|
|
|
|
|
|
// let log = logger({})
|
|
|
|
before(async () => {
|
|
|
|
// log = logger({ package:'@uci/sync', id: 'sync-test' })
|
|
|
|
let options = {source:'./test/repo', ignored:['**/dontwatch.js'],ignoreList:['./test/repo/.gitignore']}
|
|
|
|
let watcher = new Watcher(options)
|
|
|
|
await watcher.start()
|
|
|
|
watcher.on('changed',
|
|
|
|
(change) => {
|
|
|
|
console.log(`======= file ${change.file} was ${change.type} ==========`)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2019-08-10 21:21:33 -07:00
|
|
|
// it('can watch for file delete' , async function () {
|
|
|
|
// // let [err,res] = await to(remote.exec('cd /opt && pwd'))
|
|
|
|
// // if (err) {
|
|
|
|
// // log.info('error running command aborting test', err)
|
|
|
|
// // return
|
|
|
|
// // }
|
|
|
|
// // log.info(`result of remote command ${res.command} => ${res.reply.toString().trim()}`)
|
|
|
|
// expect('test', 'test failed').to.equal('test')
|
|
|
|
// })
|
2019-02-16 11:40:48 -08:00
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
// function hooks(remote) {
|
|
|
|
//
|
|
|
|
|
|
|
|
// // beforeEach(async() => {
|
|
|
|
// // await someasyncfunctiontodobeforeeachtest()
|
|
|
|
// // })
|
|
|
|
//
|
|
|
|
// // after(async() => {
|
|
|
|
// // await someasyncfunctiontodoaftereeachtest()
|
|
|
|
// // })
|
|
|
|
//
|
|
|
|
// }
|