@@ -66,7 +66,7 @@ describe('ts-node-dev', function () {
6666 await ps . waitForLine ( / \[ E R R O R \] / )
6767 const out = ps . getStdout ( )
6868 const err = ps . getStderr ( )
69-
69+
7070 t . ok ( / C o m p i l a t i o n e r r o r i n / . test ( err ) , 'Reports error file' )
7171 t . ok ( / [ E R R O R ] .* U n a b l e t o c o m p i l e T y p e S c r i p t / . test ( out ) , 'Report TS error' )
7272 t . ok ( / A r g u m e n t o f t y p e / . test ( out ) , 'Report TS error diagnostics' )
@@ -159,7 +159,7 @@ describe('ts-node-dev', function () {
159159 await ps . waitForLine ( / J S M O D U L E / )
160160 t . ok ( true , 'ok' )
161161 await ps . exit ( )
162- } )
162+ } )
163163
164164 it ( 'should handle -r esm option and load JS modules' , async ( ) => {
165165 const ps = spawnTsNodeDev ( [ `--respawn` , `-r esm` , `js-module.js` ] . join ( ' ' ) )
@@ -361,4 +361,15 @@ describe('ts-node-dev', function () {
361361 const list = fs . readdirSync ( cacheDir )
362362 t . ok ( list [ 0 ] === 'compiled' , '"compiled" dir is there' )
363363 } )
364+
365+ it ( 'should handle --file-change-hook flag' , async ( ) => {
366+ writeFile ( 'test.ts' , 'a' )
367+ const ps = spawnTsNodeDev ( [ `--file-change-hook` , `fileChangHook.js` , `--respawn` , `--watch` , `test.ts` , `simple.ts` ] . join ( ' ' ) )
368+ await ps . waitForLine ( / v 1 / )
369+ writeFile ( 'test.ts' , 'b' )
370+ await ps . waitForLine ( / R e s t a r t i n g .* t e s t .t s / )
371+ t . ok ( true , 'works' )
372+ await ps . exit ( )
373+ await removeFile ( 'test.ts' )
374+ } )
364375} )
0 commit comments