Added tests for detect and propagate file changes on rebuild

Adds tests for #2465