@@ -409,4 +409,51 @@ describe('TypeScript Watch API', () => {
409409 ] . join ( '\n' ) ,
410410 ] ) ;
411411 } ) ;
412+
413+ it . each ( [
414+ { webpack : '4.0.0' , async : false , ignored : '[path.resolve(__dirname, "src/model/**")]' } ,
415+ { webpack : '^4.0.0' , async : true , ignored : '"**/src/model/**"' } ,
416+ { webpack : '^5.0.0' , async : false , ignored : '/src\\/model/' } ,
417+ ] ) ( 'ignores directories from watch with %p' , async ( { webpack, async, ignored } ) => {
418+ await sandbox . load ( [
419+ await readFixture ( join ( __dirname , 'fixtures/environment/typescript-basic.fixture' ) , {
420+ FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
421+ FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
422+ ) ,
423+ TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
424+ TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
425+ WEBPACK_VERSION : JSON . stringify ( webpack ) ,
426+ WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
427+ WEBPACK_DEV_SERVER_VERSION : JSON . stringify ( WEBPACK_DEV_SERVER_VERSION ) ,
428+ ASYNC : JSON . stringify ( async ) ,
429+ } ) ,
430+ await readFixture ( join ( __dirname , 'fixtures/implementation/typescript-basic.fixture' ) ) ,
431+ ] ) ;
432+
433+ await sandbox . patch (
434+ 'webpack.config.js' ,
435+ " entry: './src/index.ts'," ,
436+ [ " entry: './src/index.ts'," , ' watchOptions: {' , ` ignored: ${ ignored } ` , ' },' ] . join (
437+ '\n'
438+ )
439+ ) ;
440+
441+ const driver = createWebpackDevServerDriver ( sandbox . spawn ( 'npm run webpack-dev-server' ) , async ) ;
442+
443+ // first compilation is successful
444+ await driver . waitForNoErrors ( ) ;
445+
446+ // then we introduce semantic error by removing "firstName" and "lastName" from the User model
447+ await sandbox . patch (
448+ 'src/model/User.ts' ,
449+ [ ' firstName?: string;' , ' lastName?: string;' ] . join ( '\n' ) ,
450+ ''
451+ ) ;
452+ // then we add a new file in this directory
453+ await sandbox . write ( 'src/model/Group.ts' , '// TODO: to implement' ) ;
454+
455+ // there should be no re-build
456+ await expect ( driver . waitForErrors ( 3000 ) ) . rejects . toBeDefined ( ) ;
457+ await expect ( driver . waitForNoErrors ( 3000 ) ) . rejects . toBeDefined ( ) ;
458+ } ) ;
412459} ) ;
0 commit comments