Skip to content

Commit

Permalink
Add auto-build onFileChange unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Sep 24, 2024
1 parent a094470 commit 19aa34a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/units/08_compile_build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,5 +512,33 @@ describe(path.basename(__filename).split('.')[0] + ':', () => {
assert.hasLog(`Building root file: ${get.path('main.tex')}`)
assert.notHasLog(`Building root file: ${get.path('subfile.tex')}`)
})

it.only('should auto-build when watched source is changed', () => {
set.config('latex.autoBuild.run', 'onFileChange')

log.start()
for (const handler of lw.watcher.src['onChangeHandlers']) {
try {
handler(vscode.Uri.file(get.path('main.tex')))
} catch (_) { }
}
log.stop()

assert.hasLog(`Auto build started detecting the change of a file: ${get.path('main.tex')}`)
})

it.only('should auto-build when watched bib file is changed', () => {
set.config('latex.autoBuild.run', 'onFileChange')

log.start()
for (const handler of lw.watcher.bib['onChangeHandlers']) {
try {
handler(vscode.Uri.file(get.path('main.bib')))
} catch (_) { }
}
log.stop()

assert.hasLog(`Auto build started detecting the change of a file: ${get.path('main.bib')}`)
})
})
})

0 comments on commit 19aa34a

Please sign in to comment.